Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: How to fix: [-Wformat-nonliteral] Date: Thu, 13 Apr 2017 08:43:18 -0700 Organization: None to speak of Lines: 35 Message-ID: References: <87mvbsv0tq.fsf@bsb.me.uk> <87h920ukud.fsf@bsb.me.uk> <4f2b7ab6-2fa0-4fc9-aea2-7912adf068b5@googlegroups.com> <2937e657-8cbe-40ad-a526-978b29bd9247@googlegroups.com> <45db5042-80fe-4900-9724-1bf2e3f7092c@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="13360d95e95b581afe8d2d731341601b"; logging-data="25401"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18iRe2Qc3uuUqAS7DfaCKeb" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:RBew4Os8eacolNBG6ka7J8Yt7D4= sha1:RTXIidxcSylT/LvUblZ7L2L/bi8= Xref: csiph.com comp.lang.c:108105 supercat@casperkitty.com writes: > On Wednesday, April 12, 2017 at 8:14:05 PM UTC-5, Keith Thompson wrote: >> Wouldn't it be better to support 32-bit "float" and reject "double"? >> It's non-conforming either way, but it would cleanly reject code that >> uses "double" and quite reasonably expects it to be wider than 32 >> bits. > > The Standard specifies that arguments to variadic functions get converted > to type "double". That's a good point. On the other hand, it might not apply to the tiny 8-bit system being discussed. I don't know whether it supports printf, or specifically printf for floating-point types. > The Standard provides a means by which implementations > can report the level of precision that their "double" types support, but > specifies a minimum which requires using longer than a 32-bit significand. True, but we're talking about a non-conforming implementation. The question is which violation is better: making double 32 bits, or not supporting double at all. The assumption is that the target supports 32-bit floating-point, but nothing wider (and it's not worthwhile to support wider floating-point in software). You can make double 32 bits, or you can drop support for double, change the promotion rules, and change the type of floating-point constants. Perhaps making double 32 bits is less intrusive. And if you make double 32 bits, what about long double? -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"