Subject: RE: [hackers-il] Re: Another Interesting Case Study: Permutations of a range of characters

From: Omer Musaev <[email-masked]>
Date: Tue, 15 Jan 2002 14:59:12 +0200

> -----Original Message-----
> From: Shlomi Fish [mailto:[email-masked]]
> Sent: Tuesday, January 15, 2002 2:43 PM
> To: [email-masked]
> Subject: [hackers-il] Re: Another Interesting Case Study: Permutations
> of a range of characters
> 
> 
> On Tue, 15 Jan 2002, mulix wrote:
> 
> > one nit pick, if i may [and even if i may not]:
> >
> > the original c program contained a malloc(), witout checking of its
> > return value. did no one else notice this, or am i the only 
> nit picker
> > in our midst? ;)
> 
> I would be a rich man if I had a Shekel for every time I used 
> malloc (or
> new or GlobalAlloc or any of their friends) without checking for their
> return values. I believe one of the assumptions of working in a modern
> UNIX environment (or Win32 or even DOS DJGPP, etc) is that 
> one has enough
> memory. I was once told that programmers complained that checking for
> errors in their code, increased the number of lines in their 
> programs by a
> factor of 4.
> 
> If the only time one uses malloc it is to allocate 5 or 20 
> bytes, and it
> fails, then checking if the return value is NULL, probably 
> won't stop the
> program from crashing anyhow.
> 
> I believe I am going to start another flamewar here, but who 
> is John Galt?

Well, code quality is of course a matter of taste, and modern 
Unix ( or win32 ) env is usually good enough at providing you
plenty of memory. So, if you want to make up a code that will
run at 90% of time, and if conciseness is of higher importance
than correctness, than yes, malloc's may be left inattended.

It is up to you, and it is not interesting.

The interesting question, is however, is why to use C for 
quick and dirty prototyping language? 

It is interesting, because on one hand, it is very easy to 
bootstrap a programm in C, to  make up a working model 
and to re-eng it later. In addition, given a nature of C 
compilers to compile almost anything that can be represented
in a text form, you can work out your model with little attention
to small details.

On ther other hand, C makes it rather hard to refactor code - 
you must go for your own techniques, conventions and patterns, 
and you have no support from compiler. In addition, while C 
compiler usually doesn't care about correctness of your code, 
C runtime doesn't either. So having some small and pecky bug
in a 1000 liner can be very painful when you do decide to track
it down.

There is yet another approach - developing in a debugger. You 
can change code in modern debuggers, and you can always recompile 
- so this approach seem to be closer to interactive development 
process evengelized by LISPers/perlers/pythoners/etc..

Just a pile of random thoughts:) 

> 
> Regards,
> 
> 	Shlomi Fish
> 
> > --
> > mulix
> >
> > http://vipe.technion.ac.il/~mulix/
> > http://syscalltrack.sf.net/
> >
> >
> >
> >
> >
> > To unsubscribe from this group, send an email to:
> > [email-masked]
> >
> >
> >
> > Your use of Yahoo! Groups is subject to 
> http://docs.yahoo.com/info/terms/
> >
> >
> 
> 
> 
> ----------------------------------------------------------------------
> Shlomi Fish        [email-masked]
> Home Page:         http://t2.technion.ac.il/~shlomif/
> Home E-mail:       [email-masked]
> 
> "Let's suppose you have a table with 2^n cups..."
> "Wait a second - is n a natural number?"
> 
> 
> ------------------------ Yahoo! Groups Sponsor 
> ---------------------~-->
> Sponsored by VeriSign - The Value of Trust
> When building an e-commerce site, you want to start with a
> secure foundation. Learn how with VeriSign's FREE Guide.
> http://us.click.yahoo.com/oCuuSA/XdiDAA/yigFAA/saFolB/TM
> --------------------------------------------------------------
> -------~->
> 
> To unsubscribe from this group, send an email to:
> [email-masked]
> 
>  
> 
> Your use of Yahoo! Groups is subject to 
> http://docs.yahoo.com/info/terms/ 
> 
>