Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #380557
| From | Kaz Kylheku <433-929-6894@kylheku.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Effect of CPP tags |
| Date | 2024-01-21 04:46 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <20240120203343.615@kylheku.com> (permalink) |
| References | (2 earlier) <4434vmp2fl.fsf@be-well.ilk.org> <87wmsyuj1l.fsf@nosuchdomain.example.com> <20231228134234.49@kylheku.com> <87sf3lvs43.fsf@nosuchdomain.example.com> <86y1cjiqpu.fsf@linuxsc.com> |
On 2024-01-20, Tim Rentsch <tr.17687@z991.linuxsc.com> wrote: > Keith Thompson <Keith.S.Thompson+u@gmail.com> writes: > >> [...] Just including <unistd.h> has undefined behavior as far as >> ISO C is concerned, [...] > > Not true. The behavior of #include <unistd.h> is defined in > section 6.10.2 p2. One of two things is true: either the header > named is part of the implementation, or it isn't. If the named > header is part of the implementation, then it constitutes a > language extension, and so it must be documented (and defined). The problem with this reasoning is 1. Implementations in fact have internal headers that are not documented, and which are not supposed to be included directly. You will not get documentation for every single header that is accessible via #include, and it is not reasonable for ISO C to require it. I don't see where it does. 2. A documented extension continues to be undefined behavior. The behavior is "defined", but not "ISO C defined". So even if all the implementation's internal headers were documented as extensions, their use would still be UB. Undefined behavior is for which "this document imposes not requirements", right? It is not behavior for which "this document, together with the ocumentation accompanying a given implementation, imposes no requirements". Just "this document" (and no other). If "this document" imposes no requirements, it's "undefined behavior", no matter who or what imposes additional requirements! Intuitively, a header which is part of an implementation can do anything. For instance #include <pascal.h> can cause the rest of the translation unit to be analyzed as Pascal syntax, and not C. An implementation can provide a header <reboot.h>, including which causes a reboot at compile time, link time, or execution time. If such headers happen to exist, what in the standard is violated? I used to experience a lot of push-back against the above views, but I'm seeing that people are coming around. -- TXR Programming Language: http://nongnu.org/txr Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal Mastodon: @Kazinator@mstdn.ca NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar
Re: Effect of CPP tags Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-01-20 14:29 -0800
Re: Effect of CPP tags Kaz Kylheku <433-929-6894@kylheku.com> - 2024-01-21 04:46 +0000
Re: Effect of CPP tags James Kuyper <jameskuyper@alumni.caltech.edu> - 2024-01-21 10:56 -0500
Re: Effect of CPP tags James Kuyper <jameskuyper@alumni.caltech.edu> - 2024-01-21 12:11 -0500
Re: Effect of CPP tags Kaz Kylheku <433-929-6894@kylheku.com> - 2024-01-21 17:55 +0000
Re: Effect of CPP tags James Kuyper <jameskuyper@alumni.caltech.edu> - 2024-01-21 21:57 -0500
Re: Effect of CPP tags Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-01-24 07:42 -0800
csiph-web