Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c Subject: Re: How to avoid an overflow during multiplication? Date: Sat, 22 Jan 2022 09:44:02 -0800 Organization: A noiseless patient Spider Lines: 46 Message-ID: <86y237oecd.fsf@linuxsc.com> References: <8735m954yz.fsf@bsb.me.uk> <877dbk36qu.fsf@nosuchdomain.example.com> <86v8ydp57h.fsf@linuxsc.com> <867daspnbt.fsf@linuxsc.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="434625eb2bdf5b21805d62a567edd212"; logging-data="22694"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/2c1LeZmCh6x5elUgO47H8bfPJOzr+2sg=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:Vn7b5yNykNt1PEHkFt2PqLBQFRk= sha1:zgPUaMmrYBZ4QDtmgNEpWFZapfQ= Xref: csiph.com comp.lang.c:164544 Mateusz Viste writes: > 2022-01-21 at 17:32 -0800, Tim Rentsch wrote: > >> That was interesting, thank you. Can I ask you to repeat the >> experiment with -std=c89 -pedantic-errors > > In fact that was the case already, albeit I use -pedantic in lieu of > -pedantic-errors to avoid stopping early if possible. > >> Also if it isn't too much bother, with -std=c99 -pedantic-errors. > > I didn't see any new errors. There was a lot less errors/warnings > overall, which is not surprising since c99 brings some of the > extensions present in gnu89. The fact that there was less warnings made > me spot two that I hadn't noticed earlier (although they are present > in both -c89 and -c99): > > DT_LNK > initgroups() Both of these are amenable to the posix.h scheme I mentioned in my earlier posting. Also, after a bit more investigation, I discovered select() is not the problem I thought it was; an interface for select() can be provided in the same way as the other functions, including FD_CLR etc (although for clients these will be function calls rather than macros). > So to answer your question: no, -c99 did not result in any new errors > compared to -c89. I wonder, though - why did you think it could? Isn't > c99 a superset of c89? [...] My question was mostly about whether -pedantic would add anything. However, there are constructs that are legal in C89/C90 but in C99 are constraint violations. There aren't many of these, and mostly I expect they would not come up, but I thought it worth asking the question. > The only possible reason I see is that when > compiling in -c89, make could abort earlier since it will stop at the > first module file in error, hence some of the C files won't even be > looked at. Is that what you thought about? No, I was unconsciously assuming that you would manage your build process well enough so that there wouldn't be any problems along these lines.