home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!snorkelwacker.mit.edu!ai-lab!next.cambridge.ma.us!simsong
- From: simsong (Simson L. Garfinkel)
- Newsgroups: comp.sys.next.programmer
- Subject: Re: "bind"ing sockets, -ObjC, and memset....A puzzle
- Message-ID: <1992Aug28.190230.2670@next.cambridge.ma.us>
- Date: 28 Aug 92 19:02:30 GMT
- References: <1992Aug26.043241.2355@relief.com>
- Sender: simsong@next.cambridge.ma.us
- Reply-To: simsong@next.cambridge.ma.us
- Organization: Simson Garfinkel and Associates, Inc.
- Lines: 44
-
- Apparently, when you include the -ObjC flag, all stack variables are
- initialized to 0.
-
- Here's a simple test program:
-
- int foo(n)
- {
- int a,b;
- char f[2342];
- int c;
-
- printf("a=%d b=%d c=%d\n",a,b,c);
- a = n;
- c = n;
- }
-
- main()
- {
- int a,b,c;
-
- foo(0);
- foo(2);
- }
-
-
-
- And here is the output:
-
- altos> cc x.c
- altos> a.out
- a=84032826 b=212 c=0
- a=212 b=57628 c=0
- altos> cc -ObjC x.c
- altos> a.out
- a=0 b=0 c=0
- a=0 b=0 c=0
- altos> %
-
-
- (ps: Other variables in the sin structure are used; it's always a good idea to
- initialize things to 0.)
- --
-
- ................................................................simson
-