Re: glib outstanding stuff



Trog <trog gtk org> writes:

> On 04-Oct-2000 Havoc Pennington wrote:
> > 
> >  - g_file_get_contents ()
> > 
> >    Read an entire file into a string
> > 
> 
> Whats the justification for having this function?
> 
> It strikes me as a convenience function for lazy programmers who
> can't be bothered to do things properly.

The "lazy" way to do things is often the right way to do
things - programmer time is usually the most valuable commodity
on a project, and less code means less bugs.

Obviously, you shouldn't be slurping whole files in if there is a
chance that the file is larger than the memory you have available, and
you could handle the task at hand just as easily line-by-line.

But many things are easier when you have the whole file
in memory at once, and its better to provide such a function
than have people write it themselves.

Regards,
                                        Owen






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]