|
Posted by vippstar on June 19, 2008, 6:55 am
Please log in for more thread options
>
>
>
>
>
>
>
> >> >> Dennis wrote:
> >> >>> Hi, I have a text file that contents a list of email addresses like
> >> >>> this:
> >> >> /* BEGIN new.c output */
> >> >><snip 250+ lines of C >
> >> > Wow - All that just to separate @hotmail.com from anything else ? I'm
> >> > glad I stuck with perl :)
>
> >> I think pete just enjoys writing huge amounts of C code. Or showing off..
> > Or using concrete functions he has written in the past to write
> > concrete programs.
>
> I thought it was some sort of unwritten rule here that when posting code
> solutions you tend not to import large elements of your own library.
> Otherwise everyone would post their own different version of getline() and
> so on.
There's no such rule
> And also there's the possibility, as seems to have happened here, of using
> something inappropriate just because it's there. There's no reason at all to
> use a linked list to read all the input into memory (and risking
> out-of-memory or thrashing for large input).
What do you mean thrasing? The code risks nothing as all the calls to
malloc, etc are checked.
> (Although I suspect pete may have created this over-the-top solution on
> purpose..)
Yes, presumably the purpose was to provide the newbie with a concrete
example
> > concrete programs.
>
> Which is more concrete, this code which has a memory requirement of N or
> code using fixed memory?
It doesn't matter as long as error checking is there.
|