cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/27/17:33:13

From: fist1000 AT aol DOT com (Fist1000)
Newsgroups: comp.os.msdos.djgpp
Subject: Proper use of the & operator
Lines: 24
Message-ID: <1998042721215600.RAA07160@ladder01.news.aol.com>
NNTP-Posting-Host: ladder01.news.aol.com
Date: 27 Apr 1998 21:21:56 GMT
Organization: AOL http://www.aol.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

If I have an array, for example:

    char strbuf[13];

what does &strbuf, yield? I usually do the following to zero such an array:

    memset(strbuf, 0, 13);

or

    memset(&strbuf[0], 0, 13);

but i've recently noticed the following in someone else's code:

    memset(&strbuf, 0, 13);

I thought this was invalid, but it seems to compile. I'm no master of pointers
or references, but that seems incorrect. I've been porting some code from DJGPP
to Watcom, and in many cases in the Watcom code, it doesn't like &strbuf and
will give me a bunch of bogus data. Anyone have any insight into this? Please
reply by e-mail. Thanks.

Later,
Aen (fist1000 AT aol DOT com)  

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019