stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <>
Subject Re: test for 21.string.copy
Date Mon, 27 Mar 2006 19:08:19 GMT
Anton Pevtsov wrote:
> The attached file contains the test updated according to your notes.


> Martin Sebor's wrote:
>> <>> Second, in the test function, I would like to use rw_match() instead
>> <>of Traits::compare() to verify that the contents of the buffer match 
>> the
>> expected result. This will let us avoid widening the expected
>> result and enable us to display the offset of the first mismatched
>> character (if any) in the rw_assert() diagnostic message.
> Ok, but I have a note: rw_match compares symbols only, so it is possible
> that two UserChar's with different .f and equal .c parts will be 
> interpreted
> as equal. Currently this affects nothing, but it might become a problem.<>

Yes. The long double UserChar member is there only to verify that
the library doesn't make any assumptions about the alignment of
characters (long double usually has the strictest alignment
requirement of all types). The member isn't currently being used
for anything else (except to check it's zero for eos()).

In the future we might want to make use of the long double member
to encode characters outside the extended ASCII range. If and when
we do we will also have to change rw_match() and probably also

> Martin Sebor's wrote:
>> <>> Oh, and one minor nit :) If you could move the indented #ifndef
>> <>reprocessor directives to the left margin that would be great :)
>> I am not sure that I understand what exact did you mean under the "left
>> margin" here - 0 or 4 spaces left?

The pound sign should always be in column 0 to make directives easy
to see. The formatting convention used throughout the library is to
indent the name of the directive two spaces for each level of nesting,
like this:

#if LEVEL_0             // 0 spaces between '#' and "LEVEL_0"
#  if LEVEL_1           // 2 spaces between '#' and "LEVEL_1"
#    if LEVEL_2         // 4 spaces between '#' and "LEVEL_2"
#      include <file>   // 6 spaces
#      error "text"     // 6 spaces
#      pragma foobar    // 6 spaces
#    else               // back to 4 spaces
#    endif              // LEVEL_2
#  endif                // LEVEL_1
#endif                  // LEVEL_0

Code within the blocks controlled by the directives is indented
according to the usual rules (i.e., not affected by the nesting
of preprocessor directives).


View raw message