[prog] Solution

Jenn Vesperman jenn at anthill.echidna.id.au
Sat Feb 1 12:08:10 EST 2003


On Sat, 2003-02-01 at 04:24, Sachin wrote:

(Jenn puts linuxchix-coordinator hat on for a meta-discussion)
 
PLEASE don't post attachments! 
I'm running this at the grace of my and my husband's workplace, and
we're trying to limit the bandwidth usage. If people get into the habit
of posting attachments to the mailing lists, we may exceed reasonable
usage very quickly. (Our host is paying by-the-byte. Play nice.)

No attachments. 

If you want to share code snippets, post inline. If you want to share
larger pieces of code, put them on a webpage and use your bandwidth.
This bandwidth is for discussion only.


(Coordinator hat comes off. Jenn now posts as herself.)

> I just want you to tell me whether
> my approach of modularisation(separating header files and C source code,
> :--)  ) is correct.

I can't see a need to have separate header files for each set of
#included code, nor to surround the #included code in #ifdefs. C will
only link the headers once, it should be fine to multiply include them
if you do wind up doing so. 

>                                                             Also,beyond the
> message "segmentation fault" ,I am not able to glean much information
> regarding the status of the program.

Easy-peasy. 

At various points in the program, put the following: 

#ifdef DEBUG
 printf(logfile, "The program is at this stage, with these variables
having values foo, bar and baz");
#endif

(only correct the syntax. And don't forget to open and close the logfile
at the start and end of the program.)

> I've also found that compiling
> with -Wall option saves a lot of headache,

Does lint still exist? Anyone know?

> but I still get the problem even
> when the program contains no dynamically allocated memory(which is
> considered a main source of Segmentation fault).Can anyone elaborate what
> are the potential bugs  for the  generation of segmentation fault.

Do you use any pointers?


Jenn V.
-- 
    "Do you ever wonder if there's a whole section of geek culture 
        	you miss out on by being a geek?" - Dancer.
 My book 'Essential CVS' will be published by O'Reilly in 2003.
jenn at anthill.echidna.id.au     http://anthill.echidna.id.au/~jenn/





More information about the Programming mailing list