Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Spurious diagnostic messages Date: Sun, 26 Jul 2015 15:35:40 -0700 Organization: None to speak of Lines: 34 Message-ID: References: <662af1c4-4aff-4810-9a67-b913281fab59@googlegroups.com> <874mn5ty3y.fsf@kst-u.example.com> <87egm8qis7.fsf@kst-u.example.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="11916"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19cdwdBfor171bn9ct/ZdOb" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:iR0hrPrdyreDUlsmxVGPgPkcGQQ= sha1:XmGzG36km7kfFHRoZPnPzhLIXUc= Xref: csiph.com comp.lang.c:66424 Bartc writes: [...] > What is the programmer cost of *not* using the feature? It's got to be > practically zero, surely? Because no-one is obliged to use it. As for > the costs of actually implementing it per compiler, well you can > probably estimate that for yourself. > > FYI, in the case of gcc, Clang, DMC, lccwin, and Tiny C, it's zero > because it's already done. (The feature in question is binary literals, like the 0b11001001 currently supported as an extension by gcc and some other C compilers. Personally, I favor adding them to the language, but there's at least one more question to answer. Currently printf and scanf support integer I/O for octal, decimal, and hexadecimal. Should they also support binary? "%b" is not currently used, so that would be the obvious solution. A "#" flag could cause printf to print the "0b" or "0B" prefix; "%#b" could print a "0b" suffix, "%#B" could print a "0B" prefix, and "%b" and "%B" would be identical (unlike "%x" and "%X"). It's not an overwhelming burden but it is a little extra work. Interestingly, glibc's printf and scanf don't support binary -- but Perl's printf function does. Using "%b" for printf and scanf might break some other existing functions that use extended format strings. -- 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"