delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2005/07/07/05:46:13

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Message-ID: <42CCF54B.4DBA817A@yahoo.com>
From: CBFalconer <cbfalconer AT yahoo DOT com>
Organization: Ched Research http://cbfalconer.home.att.net
X-Mailer: Mozilla 4.75 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: pointers in Strucrure assignment problem
References: <1120713425 DOT 526371 DOT 222910 AT g47g2000cwa DOT googlegroups DOT com> <TG4ze.17390$pa3 DOT 15032 AT newsread2 DOT news DOT atl DOT earthlink DOT net>
Lines: 25
Date: Thu, 07 Jul 2005 09:34:54 GMT
NNTP-Posting-Host: 12.76.141.58
X-Complaints-To: abuse AT worldnet DOT att DOT net
X-Trace: bgtnsc05-news.ops.worldnet.att.net 1120728894 12.76.141.58 (Thu, 07 Jul 2005 09:34:54 GMT)
NNTP-Posting-Date: Thu, 07 Jul 2005 09:34:54 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Martin Ambuhl wrote:
> 
... snip ...
> 
> A more efficient approach is
> 
> #define STRSIZE 100
> 
>     if (!(LD[i].LinePtr = malloc(STRSIZE))) { /* handle error */ }
>     *LD[i].LinePtr = 0;

How does that bind?  I am always deeply suspicious of C's
hierarchy, so I would (in self defense) write:

         *(LD[i].LinePtr) = '\0';
or even
         *((LD[i]).LinePtr) = '\0'; /* for total paranoia */

-- 
"If you want to post a followup via groups.google.com, don't use
 the broken "Reply" link at the bottom of the article.  Click on 
 "show options" at the top of the article, then click on the 
 "Reply" at the bottom of the article headers." - Keith Thompson


- Raw text -


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