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,436 of 33,346    |
|    =?ISO-8859-1?Q?Daniel_Kr=FCgler?= to All    |
|    Re: passing uninitialized arguments    |
|    31 Aug 11 17:33:37    |
      From: daniel.kruegler@googlemail.com              Am 31.08.2011 23:55, schrieb camster02813@yahoo.com:       > I know i should understand how this code works,       > but...............       > I see how int "number" is passed to the function "Factor" after being       > input from the keyboard (console)-       > However&"squared" and&"cubed" are passed uninitialized from       > main......and every thing does work as it should.       > Why dont the uninitialized values cause problems???- simply because       > they being passed as references???              They are not passed as references, but the addresses are taken. Taking       the address of an object does not depend on its contents (I ignore for       this the possibility of overriding the unary operator&) and the adress       of an object is well-defined irrespective of it's contents. There is a       different way of looking at the same thing: The function call of Factor       requires three arguments with well-defined values. The first argument       (number) is well-defined, if the user has indeed provided a character       sequence that could be converted into a valid number, the second and       third arguments are pointer values which are well-defined, because both       squared and cubed have been assigned valid addresses at the point of the       call.              HTH & Greetings from Bremen,              Daniel Krügler                     --        [ 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