Re: [avr-libc-dev] selective linking of floating point support for *printf / *scanf
On Fri, Aug 29, 2014 at 9:20 PM, Eric Blake wrote: > On 08/29/2014 12:04 AM, Thomas Preud'homme wrote: > > >> So are you saying you are stuck with printf_float? > > > > It's not printf_float but _printf_float. I was told double underscore is > only > > necessary with old toolchain as they might add a leading underscore. So > > _printf_float should not pose any kind of problem. > > Yes, it does. The namespace reserved for the implementation is _[_A-Z]. > The namespace _[a-z] is still available for the user. Which means the > user can declare their own _printf_float, and WE (as the implementation) > MUST NOT INTERFERE with it. Since WE are the implementation, we should > use the namespace reserved for us, namely __printf_float. > > You mean _[_a-z] (lower case) is the namespace reserved for implementation, right? -- Cheers, Grissiom ___ AVR-libc-dev mailing list AVR-libc-dev@nongnu.org https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Re: [avr-libc-dev] selective linking of floating point support for *printf / *scanf
On 08/29/2014 10:03 AM, Eric Blake wrote: > On 08/29/2014 09:51 AM, Grissiom wrote: >>> Yes, it does. The namespace reserved for the implementation is _[_A-Z]. >>> The namespace _[a-z] is still available for the user. Which means the >>> user can declare their own _printf_float, and WE (as the implementation) >>> MUST NOT INTERFERE with it. Since WE are the implementation, we should >>> use the namespace reserved for us, namely __printf_float. >>> >>> >> You mean _[_a-z] (lower case) is the namespace reserved for implementation, >> right? > > No, I spoke correctly. The namespace reserved for the implementation is > all double underscores, and all single underscore followed by a capital. > Single underscore followed by a lower case is NOT reserved for the > implementation, and is therefore free for use by the user, and therefore > the implementation must not interfere with the user's use of that namespace. Quoting POSIX: http://pubs.opengroup.org/onlinepubs/9699919799/toc.htm > The following identifiers are reserved regardless of the inclusion of headers: > > 1. > With the exception of identifiers beginning with the prefix _POSIX_, all > identifiers that begin with an and either an uppercase letter or > another are always reserved for any use by the implementation. > 2. > All identifiers that begin with an are always reserved for > use as identifiers with file scope in both the ordinary identifier and tag > name spaces. >... Of course, that list feels a bit too restrictive in light of existing standardized uses of underscore followed by capital. such as _Bool and _Exit in C99; and C11 has introduced even more things like _Noreturn. But the REASON that C has been able to extend the language and add more keywords beginning with underscore-capital is precisely because those names were reserved for the implementation, not the user, so it can't break any user code. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature ___ AVR-libc-dev mailing list AVR-libc-dev@nongnu.org https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Re: [avr-libc-dev] selective linking of floating point support for *printf / *scanf
On 08/29/2014 12:04 AM, Thomas Preud'homme wrote: >> So are you saying you are stuck with printf_float? > > It's not printf_float but _printf_float. I was told double underscore is only > necessary with old toolchain as they might add a leading underscore. So > _printf_float should not pose any kind of problem. Yes, it does. The namespace reserved for the implementation is _[_A-Z]. The namespace _[a-z] is still available for the user. Which means the user can declare their own _printf_float, and WE (as the implementation) MUST NOT INTERFERE with it. Since WE are the implementation, we should use the namespace reserved for us, namely __printf_float. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature ___ AVR-libc-dev mailing list AVR-libc-dev@nongnu.org https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Re: [avr-libc-dev] selective linking of floating point support for *printf / *scanf
On 08/29/2014 09:51 AM, Grissiom wrote: >> Yes, it does. The namespace reserved for the implementation is _[_A-Z]. >> The namespace _[a-z] is still available for the user. Which means the >> user can declare their own _printf_float, and WE (as the implementation) >> MUST NOT INTERFERE with it. Since WE are the implementation, we should >> use the namespace reserved for us, namely __printf_float. >> >> > You mean _[_a-z] (lower case) is the namespace reserved for implementation, > right? No, I spoke correctly. The namespace reserved for the implementation is all double underscores, and all single underscore followed by a capital. Single underscore followed by a lower case is NOT reserved for the implementation, and is therefore free for use by the user, and therefore the implementation must not interfere with the user's use of that namespace. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature ___ AVR-libc-dev mailing list AVR-libc-dev@nongnu.org https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Re: [avr-libc-dev] selective linking of floating point support for *printf / *scanf
> From: Grissiom [mailto:chaos.pro...@gmail.com] > Sent: Friday, August 29, 2014 11:51 PM > > Yes, it does. The namespace reserved for the implementation is _[_A-Z]. > The namespace _[a-z] is still available for the user. Which means the > user can declare their own _printf_float, and WE (as the implementation) > MUST NOT INTERFERE with it. Since WE are the implementation, we should > use the namespace reserved for us, namely __printf_float. Mmmh indeed. I checked C99 and section 7.1.3 paragraph 1 third clause states: "All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use." Next clause express how single underscore not followed by a capital letter is reserved: "All identifiers that begin with an underscore are always reserved for use as identifiers with file scope in both the ordinary and tag name spaces." Since here we are talking about linkage, _printf_float is not safe according to the standard. Sigh. Ok I need to think about it. Thank you all for pointing out the problem with the current scheme. Best regards, Thomas ___ AVR-libc-dev mailing list AVR-libc-dev@nongnu.org https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Re: [avr-libc-dev] selective linking of floating point support for *printf / *scanf
> -Original Message- > From: gcc-ow...@gcc.gnu.org [mailto:gcc-ow...@gcc.gnu.org] On Behalf > Of Thomas Preud'homme > Sent: Saturday, August 30, 2014 12:27 PM > Mmmh indeed. I checked C99 and section 7.1.3 paragraph 1 third clause > states: > > "All identifiers that begin with an underscore and either an uppercase letter > or > another underscore are always reserved for any use." > > Next clause express how single underscore not followed by a capital letter > is > reserved: > > "All identifiers that begin with an underscore are always reserved for use as > identifiers > with file scope in both the ordinary and tag name spaces." > > Since here we are talking about linkage, _printf_float is not safe according > to the > standard. Sorry for restating what Eric Blake already said, I didn't see his message at first as it was (surprisingly) classified as spam. Best regards, Thomas ___ AVR-libc-dev mailing list AVR-libc-dev@nongnu.org https://lists.nongnu.org/mailman/listinfo/avr-libc-dev