Talk:c/preprocessor/line
From cppreference.com
< Talk:c
I checked both C90 and C99 and couldn't find support for the following claim:
> The line number following the directive #line __LINE__ is implementation-defined
Should we remove that sentence? Gennaro Prota (talk) 03:46, 17 May 2018 (PDT)
- that's in 6.10.4/5 and J.1 in C17, added by DR 464, but it applies to prior revisions since it's a defect and since different compilers do it differently. --Cubbi (talk) 04:13, 17 May 2018 (PDT)
- Aha, thanks. From my reading of the DR, however, it's unspecified, not implementation-defined. Does the standard say "implementation-defined", instead? In any case, it would be good to add our usual (at least for C++) "the following DRs were retroactively applied to existing standards" (I've not verified the exact text, just recalling it from memory). Gennaro Prota (talk) 08:53, 18 May 2018 (PDT)
- Good point, yes, "unspecified behavior". We usually make that DR table when there is a change in behavior (otherwise, on C++ side, there would be a wall of text on some pages!): this is just clarifying that the spec was always inconsistent. Maybe tack a link to DR onto to that sentence. --Cubbi (talk) 09:11, 18 May 2018 (PDT)
- Apparently, nobody had acted on this in four years, so I did. But why did they make the behavior unspecified? The implementation knows whether it uses a one-pass preprocessor or not; so why can't it just subtract one, if needed? —Gennaro Prota•Talk 07:19, 27 May 2022 (PDT)