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 33,245 of 33,346    |
|    Francis Glassborow to James K. Lowden    |
|    Re: is using memcopy() to manipulate arr    |
|    10 Oct 13 09:58:51    |
   
   From: francis.glassborow@btinternet.com   
      
   On 10/10/2013 07:38, James K. Lowden wrote:   
   > int encoded[11],syndrome[4];   
   > ...   
   > syndrome[i]+=(edata[j]*hmatrix[i][j]);   
   >   
   > You seem to assume here that syndrome is initialized to zeros. It's   
   > not, or at least won't always be. You can say   
   >   
   > int syndrome[4] = {0};   
   >   
   > because the standard says that remaining elements are initialized to   
   > the the last provided initialization value. Roughly.   
      
   For some extreme value of roughly:) What it actually requires is that   
   all the surplus elements (the ones where you do not provide an   
   initialiser) when you have provided at least one initialiser will be   
   initialised to 0.   
    int syndrome[4] = {1};   
      
   is equivalent to   
      
    int syndrome[4] = (1, 0, 0, 0};   
      
      
   --   
    [ 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