🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.programmer
Article #880

Re: "bind"ing sockets, -ObjC, and memset....A puzzle

#880
From: simsong Simson L. Garfinkel
Date: Fri, 28 Aug 1992 19:02
44 lines
1236 bytes
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
Technical Details
Message-ID: <1992Aug28.190230.2670@next.cambridge.ma.us>
Path: arc1-ca.pugleaf.net!sparky!uunet!snorkelwacker.mit.edu!ai-lab!next.cambridge.ma.us!simsong
References: <1992Aug26.043241.2355@relief.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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