Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Newsgroups | comp.std.c |
| Subject | Re: null pointer constant, address constant |
| Date | 2012-12-18 20:24 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <kar51c$oaj$1@dont-email.me> (permalink) |
| References | <kapqt2$es4$1@speranza.aioe.org> <kaq01g$6jp$1@dont-email.me> <kaqibr$gj3$1@speranza.aioe.org> <50D0D492.20007@verizon.net> <kar2ku$o89$1@speranza.aioe.org> |
On 12/18/2012 07:44 PM, Szabolcs Nagy wrote: ... >> Can you give an example where it was reasonable, in a context where an >> ICE was required, to use an expression that pushed (or exceeded) the >> limits on what is permitted for an ICE? > > it is required for an elaborate hack to workaround a > silliness of the standard that is tgmath.h > > (ie. i have an implementation of tgmath.h which is > done with minimal compiler support using the typeof > extension present in many compilers) > (yes c11 _Generic could solve the issue but is not > practical as it is not supported on the compilers i > care about and i cannot modify the compilers, i'm > only implementing the standard library) > > while testing the implementation it turned out that the > tested compilers disagreed about what is an ICE or a > null pointer constant (so it's not that trivial matter > after all) That is, I hope you'll admit, a rather unusual situation. > eg on some compilers > > #define __is_integral(x) !((1?1:x)/2) > __is_integral(1.0) > > is an ICE and null pointer constant on others not Because 1.0 is not the immediate operand of a cast, that doesn't qualify as an ICE, and therefore does not qualify as an NPC. The compilers that disagree are wrong. How did you use this macro, such that it needed to be an ICE or an NPC? > 0 ? (double*)0 : 0 ? (void*)0 : (void*)0 > > has type double* on some compilers on others void* The inner ?: expression is a constant expression with a null pointer value, but not a null pointer constant. Therefore, the outer ?: expression should have the type void*. > none of the tested compilers are completely standard > conformant (gcc, clang) which means i can implement > tgmath.h with typeof only, if they were conformant i > could not I believe that gcc can fully conform to C90, and probably to C99, with the right compiler options. I thought the same was true of clang, but I'm not as familiar with that compiler. If you need to use the compiler in a non-conforming mode, I suppose it doesn't help to know that it also has a conforming mode. -- James Kuyper
Back to comp.std.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
null pointer constant, address constant Szabolcs Nagy <nsz@port70.net> - 2012-12-18 13:25 +0000
Re: null pointer constant, address constant James Kuyper <jameskuyper@verizon.net> - 2012-12-18 09:53 -0500
Re: null pointer constant, address constant Szabolcs Nagy <nsz@port70.net> - 2012-12-18 20:06 +0000
Re: null pointer constant, address constant James Kuyper <jameskuyper@verizon.net> - 2012-12-18 15:39 -0500
Re: null pointer constant, address constant Szabolcs Nagy <nsz@port70.net> - 2012-12-19 00:44 +0000
Re: null pointer constant, address constant James Kuyper <jameskuyper@verizon.net> - 2012-12-18 20:24 -0500
Re: null pointer constant, address constant Szabolcs Nagy <nsz@port70.net> - 2012-12-19 10:27 +0000
Re: null pointer constant, address constant James Kuyper <jameskuyper@verizon.net> - 2012-12-19 07:15 -0500
Re: null pointer constant, address constant Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-12-21 03:03 +0200
Re: null pointer constant, address constant James Kuyper <jameskuyper@verizon.net> - 2012-12-21 12:13 -0500
Re: null pointer constant, address constant Szabolcs Nagy <nsz@port70.net> - 2013-01-09 00:44 +0000
Re: null pointer constant, address constant James Kuyper <jameskuyper@verizon.net> - 2013-01-08 20:21 -0500
Re: null pointer constant, address constant Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-01-08 20:46 -0500
Re: null pointer constant, address constant Shao Miller <sha0.miller@gmail.com> - 2012-12-18 20:37 -0500
Re: null pointer constant, address constant Shao Miller <sha0.miller@gmail.com> - 2012-12-18 16:15 -0500
Re: null pointer constant, address constant Keith Thompson <kst-u@mib.org> - 2012-12-18 15:52 -0800
Re: null pointer constant, address constant Shao Miller <sha0.miller@gmail.com> - 2012-12-18 19:12 -0500
Re: null pointer constant, address constant Shao Miller <sha0.miller@gmail.com> - 2012-12-18 19:51 -0500
Re: null pointer constant, address constant Keith Thompson <kst-u@mib.org> - 2012-12-18 17:02 -0800
Re: null pointer constant, address constant "christian.bau" <christian.bau@cbau.wanadoo.co.uk> - 2012-12-20 05:34 -0800
Re: null pointer constant, address constant James Kuyper <jameskuyper@verizon.net> - 2012-12-20 10:33 -0500
Re: null pointer constant, address constant James Kuyper <jameskuyper@verizon.net> - 2012-12-20 12:28 -0500
Re: null pointer constant, address constant Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-20 21:13 -0800
Re: null pointer constant, address constant Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-20 21:05 -0800
Re: null pointer constant, address constant Shao Miller <sha0.miller@gmail.com> - 2012-12-20 12:17 -0500
Re: null pointer constant, address constant Keith Thompson <kst-u@mib.org> - 2012-12-20 12:10 -0800
Re: null pointer constant, address constant Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-20 21:25 -0800
Re: null pointer constant, address constant Shao Miller <sha0.miller@gmail.com> - 2012-12-18 14:02 -0500
Re: null pointer constant, address constant Szabolcs Nagy <nsz@port70.net> - 2012-12-18 20:09 +0000
Re: null pointer constant, address constant James Kuyper <jameskuyper@verizon.net> - 2012-12-18 15:54 -0500
Re: null pointer constant, address constant Shao Miller <sha0.miller@gmail.com> - 2012-12-18 16:18 -0500
csiph-web