* Problems with C on Alpha
@ 1999-09-13 4:00 Heiko Ronsdorf
1999-09-13 4:00 ` Bill Zettler
0 siblings, 1 reply; 2+ messages in thread
From: Heiko Ronsdorf @ 1999-09-13 4:00 UTC (permalink / raw)
This program ( simplified ) runs fine under i386 ( Linux 2.2.12, gcc
2.7),
but it won't work on alpha ( Digital UNIX 4.0a, some cc )?
main(argc, argv)
int argc;
char *argv;
{
int a;
if ( a ) then
printf(" a is true! \n");
}
Why is a not false?
Thanks for all answers
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: Problems with C on Alpha
1999-09-13 4:00 Problems with C on Alpha Heiko Ronsdorf
@ 1999-09-13 4:00 ` Bill Zettler
0 siblings, 0 replies; 2+ messages in thread
From: Bill Zettler @ 1999-09-13 4:00 UTC (permalink / raw)
What the hey? You didn't initialize the variable! It has nothing useful
in it. Maybe a compiler set for maximal debugging will automatically
initialize your automatics to 0, but you're certainly not guaranteed it
in general. Most compilers will give you an error message at this code,
because you used a variable before it was set.
Why wouldn't a compiler always set all the automatics to 0? Because it
takes time! Time that could murder a speed-critical function. So they
let you initialize your own darn variables to whatever you want.
Hope this helps,
Bill
Heiko Ronsdorf wrote:
> This program ( simplified ) runs fine under i386 ( Linux 2.2.12, gcc
> 2.7),
> but it won't work on alpha ( Digital UNIX 4.0a, some cc )?
>
> main(argc, argv)
> int argc;
> char *argv;
> {
> int a;
> if ( a ) then
> printf(" a is true! \n");
> }
>
> Why is a not false?
>
> Thanks for all answers
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1999-09-13 4:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-09-13 4:00 Problems with C on Alpha Heiko Ronsdorf
1999-09-13 4:00 ` Bill Zettler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox