From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Allocators design flaw Date: Sat, 14 Oct 2017 21:07:44 +0100 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="e53c3a1e14119dea7f561d1d98279ae1"; logging-data="3233"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18+xiDaz1/cPSjPhA7i986sW9TT/jgnoNo=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (darwin) Cancel-Lock: sha1:YMmZVvAC9osxl4z/vXg7LB+vP1Q= sha1:MyLbg9JMOHB1tikrHkh2eMlk1LU= Xref: news.eternal-september.org comp.lang.ada:48478 Date: 2017-10-14T21:07:44+01:00 List-Id: Victor Porton writes: > There is nothing in Ada standard to prevent the above "new" operator > to request 256-byte alignment of the data. (Yes, I know this does not > happen in practice, but it is not forbidden by the RM.) > > If it requests such a great alignment by the C function > *_alloc_memory() is able to do only 16-byte alignment, then my > allocator would break the contract, that is allocate with lesser > alignment than requested. Since you agree it's very unlikely that an Ada compiler would actually do that, why not just check the requested alignment & raise PE if it's too large?