This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/12019] memchr overshoots on Alpha


------- Additional Comments From bonzini at gnu dot org  2010-09-15 08:06 -------
Andreas,

7.22.5 of ISO/IEC 9899:201x (the description of memchr) never refers to S as
being an array.

Compare:

7.20.6.5. The snprintf function [...] The snprintf function is equivalent to
fprintf, except that the output is written into an array (specified by argument
s) rather than to a stream.

7.22.5. The memchr function locates the first occurrence of c (converted to an
unsigned char) in the initial n characters (each interpreted as unsigned char)
of the object pointed to by s.


Besides, even if your interpretation was correct, going beyond what the standard
promises would have other advantages.  For example: 1) consistency, as the
manual specifies that "rawmemchr (str, '\0') will never go beyond the end of the
string; 2) ease of implementing rawmemchr specially for the Alpha, based on the
Alpha memchr.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=12019

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]