🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.os2.programmer
Article #2196

Re: How to debug in OS/2 with GCC 2.2.2?

#2196
From: Stephen M. Lacy
Date: Wed, 30 Sep 1992 00:36
23 lines
1369 bytes
Excerpts from netnews.comp.os.os2.misc: 29-Sep-92 How to debug in OS/2
with G.. by Wey Jing HO@monu6.cc.mon 
> 1) declare unsigned char **variable;
> 2) variable = (unsigned char **)malloc(512*sizeof(unsigned char));
> 3) check malloc if == NULL;
> 4) variable[i] = (unsigned char *)malloc(512*sizeof(unsigned char)); 
>    for (i=0; i<512; i++); (sorry, this line should appear first)
> 5) check malloc if == NULL;
> 6) variable[row][col] = (unsigned char)fgetc(instream);

Maybe you mistyped line numeber 2, maybe its wrong.  I think it should read:

variable = (unsigned char**)malloc(512*sizeof(unsigned char*));

note the sizeof(unsigned char*) part.  That's crucial.  If what you have
typed is what you compile, I'm amazed that it ever worked, even under
DOS.


Steve


"If 'goodbye' were only a word, maybe I'd say it more often." -Stephen Lacy
Technical Details
Message-ID: <QemDOA_00YV7Q8c2ox@andrew.cmu.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!wupost!udel!rochester!cantaloupe.srv.cs.cmu.edu!crabapple.srv.cs.cmu.edu!andrew.cmu.edu!sl31+

Show Full Headers
Complete Article Headers
Organization: Junior, Math/Computer Science, Carnegie Mellon, Pittsburgh, PA
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!wupost!udel!rochester!cantaloupe.srv.cs.cmu.edu!crabapple.srv.cs.cmu.edu!andrew.cmu.edu!sl31+
Newsgroups: comp.os.os2.programmer
Message-ID: <QemDOA_00YV7Q8c2ox@andrew.cmu.edu>
Date: Tue, 29 Sep 1992 20:36:28 -0400 
From: "Stephen M. Lacy" <sl31+@andrew.cmu.edu>
Subject: Re: How to debug in OS/2 with GCC 2.2.2?
In-Reply-To: <1992Sep29.190753.4833@monu6.cc.monash.edu.au>
Lines: 24