Anonymous | Login | 2024-12-04 05:57 UTC |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||
ID | Category | Severity | Type | Date Submitted | Last Update | ||
0001413 | [Issue 8 drafts] Shell and Utilities | Objection | Error | 2020-10-24 22:01 | 2024-06-11 09:12 | ||
Reporter | philip-guenther | View Status | public | ||||
Assigned To | |||||||
Priority | normal | Resolution | Accepted As Marked | ||||
Status | Closed | Product Version | Draft 1.1 | ||||
Name | Philip Guenther | ||||||
Organization | OpenBSD | ||||||
User Reference | |||||||
Section | printf's APPLICATION USAGE | ||||||
Page Number | 3038 | ||||||
Line Number | 102845 - 102848 | ||||||
Final Accepted Text | See Note: 0005276 | ||||||
Summary | 0001413: incorrect description of how a hexadecimal character constant can be terminated in ISO C | ||||||
Description |
The text says: > In the ISO C standard, the "##" concatenation > operator can be used to terminate a constant and follow it with a hexadecimal character to be > written. In the shell, concatenation occurs before the printf utility has a chance to parse the end > of the hexadecimal constant. The ## operator is neither necessary nor sufficient. All that's needed is use of string literal concatenation. Indeed, this was an example in (at least) drafts of the C99 standard, in the specification of string literals lexical elements: # EXAMPLE This pair of adjacent character string literals # # "\x12" "3" # # produces a single character string literal containing the two characters whose values are '\x12' and '3', # because escape sequences are converted into single members of the execution character set just prior to # adjacent string literal concatenation. |
||||||
Desired Action |
Replace the sentence: In the ISO C standard, the "##" concatenation operator can be used to terminate a constant and follow it with a hexadecimal character to be written. With something like: In the ISO C standard, the constant and its following hexadecimal character can be placed in separate string literals as escape sequence processing occurs before string literal concatenation. (I'm not really happy with that phrasing; better suggestions welcome!) |
||||||
Tags | issue8 | ||||||
Attached Files | |||||||
|
Relationships | |||||||
|
Notes | |
(0005248) nick (manager) 2021-02-18 17:12 |
(TC2 page and line numbers) change page 3115 line 104182-104185, after 0000249 is resolved:In the ISO C standard, the "##" concatenation operator can be used to terminate a constant and follow it with a hexadecimal character to be written. In the shell, concatenation occurs before the printf utility has a chance to parse the end of the hexadecimal constant. to: Note however that a <tt>$'...'</tt> string may be used to embed hexadecimal constants in a format string in a portable way. |
(0005274) mirabilos (reporter) 2021-03-15 20:53 |
I don’t quite get this. In $'…' strings, \x123 is also unspecified (some current implementations make this into \x23 or even \u0123). Maybe as $'\x12'3 or, more generally, $'\x12'$'3' … hmm, but that’s not obvious from the wording. |
(0005276) geoffclare (manager) 2021-03-16 10:01 |
I see your point. Perhaps it would be better to keep the part about concatenation (with corrected wording) and say that in the shell $'...' can be used in a similar way. Something like: On 2018 edition page 3115 line 104182-104185, after 0000249 is resolved change: In the ISO C standard, the "##" concatenation operator can be used to terminate a constant and follow it with a hexadecimal character to be written. In the shell, concatenation occurs before the printf utility has a chance to parse the end of the hexadecimal constant.to: In the ISO C standard, string literal concatenation can be used to terminate a constant and follow it with a hexadecimal character to be written. In the shell, similar concatenation can be done using <tt>$'...'</tt> so that the shell converts the hexadecimal sequence before it executes printf. |
(0006011) geoffclare (manager) 2022-10-21 09:55 |
Now that bug 0000249 has been resolved, this bug can be revisited. |
Issue History | |||
Date Modified | Username | Field | Change |
2020-10-24 22:01 | philip-guenther | New Issue | |
2020-10-24 22:01 | philip-guenther | Name | => Philip Guenther |
2020-10-24 22:01 | philip-guenther | Organization | => OpenBSD |
2020-10-24 22:01 | philip-guenther | Section | => printf's APPLICATION USAGE |
2020-10-24 22:01 | philip-guenther | Page Number | => 3038 |
2020-10-24 22:01 | philip-guenther | Line Number | => 102845 - 102848 |
2021-02-18 17:11 | nick | Relationship added | child of 0000249 |
2021-02-18 17:12 | nick | Note Added: 0005248 | |
2021-02-18 17:13 | nick | Status | New => Resolution Proposed |
2021-02-18 17:13 | nick | Resolution | Open => Accepted As Marked |
2021-02-18 17:14 | nick | Final Accepted Text | => See Note: 0005248 |
2021-02-18 17:15 | nick | Tag Attached: issue8 | |
2021-03-15 20:53 | mirabilos | Note Added: 0005274 | |
2021-03-16 10:01 | geoffclare | Note Added: 0005276 | |
2022-10-21 09:55 | geoffclare | Note Added: 0006011 | |
2022-10-21 09:55 | geoffclare | Status | Resolution Proposed => Under Review |
2022-10-21 10:03 | geoffclare | Resolution | Accepted As Marked => Reopened |
2022-11-03 15:24 | geoffclare | Final Accepted Text | See Note: 0005248 => See Note: 0005276 |
2022-11-03 15:24 | geoffclare | Status | Under Review => Resolved |
2022-11-03 15:24 | geoffclare | Resolution | Reopened => Accepted As Marked |
2022-11-30 16:46 | geoffclare | Status | Resolved => Applied |
2024-06-11 09:12 | agadmin | Status | Applied => Closed |
Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group |