]> granicus.if.org Git - clang/commitdiff
Fix a wrong and confusing comment in CharUnits.h. Neither C nor C++ allows
authorRichard Smith <richard-llvm@metafoo.co.uk>
Mon, 13 May 2013 20:28:15 +0000 (20:28 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Mon, 13 May 2013 20:28:15 +0000 (20:28 +0000)
bytes and character units to be different sizes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181730 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/CharUnits.h

index 082c672c21912ffe3a0c46aea1ceb68125e06985..09ff6828ef5c2d92aeeb813664ab249d4eb3a82b 100644 (file)
 #include "llvm/Support/MathExtras.h"
 
 namespace clang {
-  
+
   /// CharUnits - This is an opaque type for sizes expressed in character units.
-  /// Instances of this type represent a quantity as a multiple of the size 
+  /// Instances of this type represent a quantity as a multiple of the size
   /// of the standard C type, char, on the target architecture. As an opaque
   /// type, CharUnits protects you from accidentally combining operations on
-  /// quantities in bit units and character units. 
+  /// quantities in bit units and character units.
+  ///
+  /// In both C and C++, an object of type 'char', 'signed char', or 'unsigned
+  /// char' occupies exactly one byte, so 'character unit' and 'byte' refer to
+  /// the same quantity of storage. However, we use the term 'character unit'
+  /// rather than 'byte' to avoid an implication that a character unit is
+  /// exactly 8 bits.
   ///
-  /// It should be noted that characters and bytes are distinct concepts. Bytes
-  /// refer to addressable units of data storage on the target machine, and
-  /// characters are members of a set of elements used for the organization,
-  /// control, or representation of data. According to C99, bytes are allowed
-  /// to exceed characters in size, although currently, clang only supports
-  /// architectures where the two are the same size.
-  /// 
-  /// For portability, never assume that a target character is 8 bits wide. Use 
+  /// For portability, never assume that a target character is 8 bits wide. Use
   /// CharUnit values wherever you calculate sizes, offsets, or alignments
   /// in character units.
   class CharUnits {