Opened 12 years ago

Closed 12 years ago

#5087 closed Patches (fixed)

test_utf8_codecvt.cpp.patch fixing comparison with wrong type

Reported by: hstong@… Owned by: Robert Ramey
Milestone: To Be Determined Component: serialization
Version: Boost 1.45.0 Severity: Problem
Keywords: Cc: ccambly@…

Description

Comparison of WEOF against wchar_t value is non-portable.

Attachments (1)

test_utf8_codecvt.cpp.patch (677 bytes ) - added by hstong@… 12 years ago.
patch libs/serialization/test/test_utf8_codecvt.cpp to avoid WEOF comparison with wchar_t

Download all attachments as: .zip

Change History (5)

by hstong@…, 12 years ago

Attachment: test_utf8_codecvt.cpp.patch added

patch libs/serialization/test/test_utf8_codecvt.cpp to avoid WEOF comparison with wchar_t

comment:1 by Robert Ramey, 12 years ago

hmmm - could you cite some reference to indicate what wint_t would be preferred to wchar_t? I've never heard of wint_t - not that that means anything. Something makes me think this would be dependent on the standard library or compiler used.

Robert Ramey

comment:2 by hstong@…, 12 years ago

The type of WEOF according to C99 is wint_t.

wint_t is the int_type for char_traits<wchar_t> as specified by C++03. As such, it is the return type for basic_istream<wchar_t>::get().

As per C99, wint_t is required to be able to hold an additional value (WEOF) aside from the ones that wchar_t are required to. It follows that WEOF may not be representable in a wchar_t.

A draft copy of C1x is available here: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1494.pdf

comment:3 by Robert Ramey, 12 years ago

OK - you've convinced me - good job.

I'll role in this change. It won't make for 1.46 though - thanks again.

Robert Ramey

comment:4 by Robert Ramey, 12 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.