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 31,371 of 33,346    |
|    Seungbeom Kim to Ulrich Eckhardt    |
|    Re: codecvt problem    |
|    23 Jun 11 14:42:07    |
   
   From: musiphil@bawi.org   
      
   On 2011-06-20 12:16, Ulrich Eckhardt wrote:   
   > Seungbeom Kim wrote:   
   >> On 2011-06-17 05:42, Ulrich Eckhardt wrote:   
   >>> This means that all "clean" initialisations   
   >>> mentioned in this thread (e.g. "mbstate_t s = {};" or "mbstate_t s =   
   >>> mbstate_t();") are actually not guaranteed to work.   
   >>   
   >> I cannot understand why not. Can you explain it further?   
   >   
   > 1. a null pointer doesn't have to have all its bits zero   
   > 2. memset(&ptr, 0, sizeof ptr) only guarantees that all bits are zero, but   
   > not that 'ptr' becomes a null pointer   
   > 3. above mentioned "clean" initialisations of pointers yield null pointers   
   >   
   > With that, assuming the spec requires an initialisation with memset(),   
   other   
   > initialisations where a pointer might become a null pointer are actually   
   not   
   > portable, because they give a different result.   
      
   I see your point. I highly doubt that such implementations that ask   
   users to use memset will not work with real null pointers produced by   
   "clean" initialisations; i.e. I expect that they are based on the   
   assumption, or guarantee, that memset does produce a real null pointer;   
   i.e. that a null pointer is all-bits-zero.   
      
   --   
   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