home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 32,062 of 33,346   
   Seungbeom Kim to Nikolay Ivchenkov   
   Re: Modification of trailing null charac   
   29 Mar 12 12:13:08   
   
   b69fa9c0   
   From: musiphil@bawi.org   
      
   On 2012-03-28 21:24, Nikolay Ivchenkov wrote:   
   > On 28 Mar, 23:13, Daniel Krügler    
   > wrote:   
   >> A valid implementation could e.g. use the same constant char object   
   >> as a common null character for all empty strings.   
   >   
   > Yes, I thought about such implementation, but I can't imagine any   
   > problems with non-empty strings. Probably, the intention was to keep   
   > the rules simple (even though they imply unnecessary restriction).   
      
   In addition, 'c_str() const' should return an array that terminates with   
   a null character (charT()), and 'operator[](size_type pos) const' should   
   return charT() for pos == size(). Therefore, I think an implementation   
   that doesn't keep a null character at the end is making things difficult   
   for itself for no good reason I can see. (Let me know if there are some.)   
      
   --   
   Seungbeom Kim   
      
      
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca