Re: Programming in standard c




"Eric Sosman" <esosman@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:jqqdnT6R6ulVsejanZ2dnUVZ_oKhnZ2d@xxxxxxxxxxxxxx
Bart C wrote:
[...]
I don't know how to deal with /var/adm/messages or similar. Suppose I
read byte-by-byte as recommended then someone updates the beginning of
the file? Maybe it's foolhardy to even attempt making a copy of such a
file. I'm not allowed to lock it because that's also frowned upon. What
exactly can one do with such a file?

There are at least two problems to be faced when dealing
with /var/adm/messages. First, the file grows as the system

Well, we can class that sort of file as Special and deal with it With Care.
Or pehaps choose not to deal with it at all. The point is most input files
(it is mostly input ones you want to read!) are known to be well-behaved (eg
config files/support files of an application) and can be dealt with less
strictly.

If we have to worry about multi-process access than we may have to consider
our entire application may suddenly disappear in a puff of smoke. It's best
not to worry about it.

Personally, I don't think much of the read-it-all-in approach
to handling data that's in files. That's because I'm from the
Old School, and learned my craft in the days when memory was
scarce and expensive.

Same here.

You
read the enormous CAD model and build data structures while reading
it; all the data winds up in memory, but you never have or need
an "image" of the entire file as it looks on disk.

Yes, I've written CAD-type software for 8-bit and MSDOS. That was fun.

Now, however, you've got 1GB RAM or whatever sitting there and you need to
do *something* with it. I'm talking about at least desktop PCs of course.

Bart



.



Relevant Pages

  • Re: concurrency, threads and objects
    ... I don't subscribe to the idea that you should not worry about resources (cpu, memory etc.), because its so cheap. ... The smaller program requires less bus bandwidth between the cpu, memory and disk and less processing cycles. ... I have numerous times created applications that require a fraction of memory or cpu power compared to a someone's idea that you should not worry about it. ... In some cases I have also created working and stable solutions when others have not managed to get one off the ground, because of code bloat. ...
    (comp.lang.java.programmer)
  • Re: Computer advice please?
    ... Don't worry about speed they are ... about 4x the battery life - which I head you ask for. ... Don't worry about video memory unless you are gaming. ...
    (alt.gathering.rainbow)
  • Re: Structure of large link libraries in f95
    ... Won't memory use and build time be about the same? ... it would save some disk space. ... Again, don't worry ... worry about large statically-sized data arrays - which are typically set ...
    (comp.lang.fortran)
  • [Full-Disclosure] ALERT ALERT plaintext passwords in linux ALERT ALERT
    ... > Don't worry, it does not actually occupy your computer's resources, except some memory. ... sometimes a kernel rootkit will hijack the stat syscall.. ...
    (Full-Disclosure)
  • Re: passing a string to a C++ function
    ... things are "unsafe". ... Other languages - eg FORTRAN - were designed to ... protect you completely from having to worry about memory. ...
    (microsoft.public.vc.language)