Re: Create empty files?



On Jan 5, 10:45 pm, Sjouke Burry <burrynulnulf...@xxxxxxxxxxxxxxxxx>
wrote:
Victor Porton wrote:
On Jan 5, 10:19 pm, Mensanator <mensana...@xxxxxxx> wrote:
On Jan 5, 12:20 pm, Victor Porton <por...@xxxxxxxx> wrote:

An application uses files with IDs.
What of the following two variants is preferred?
1. To create empty IDs files at setup script.
2. If an IDs file is missing, treat it as if it would exist but empty..
Why?
Because empty files are not "empty" as far as the directory is
concerned.

You should first answer first of my questions and only then the
second!

From what you say about my second question, I assume that your answer
to the first question is:

2. If an IDs file is missing, treat it as if it would exist but empty.

The directory entry may not point to anything, but it takes up space.
A directory block can typically only hold 512 entries. When the
directory
gets larger than that, a new block must be allocated. Very likely this
will result in a fragmented directory, making it much more difficult
to scan through. This may not be applicable to all OSes, I remember it
from observing some clown who put thousands of files into a single
directory
and then wondered why it was slower than snake shit.

A few bytes of free space isn't a concern for the particular
application which I write.

Also adding to the source code processing of non-existing files would
probably eat comparable quantity of bytes as would creation of these
files.

I'm more interested in programming beautify and clarity than in a few
bytes of free space.

Does anybody else have an opinion on my question?

Why?? Your opinion seems firmly set.

My opinion is not set nor on "1" nor or "2".

I ask all what is YOUR preferred choice: "1" or "2":

1. To create empty IDs files at setup script.
2. If an IDs file is missing, treat it as if it would exist but empty.
.



Relevant Pages

  • Re: Create empty files?
    ... To create empty IDs files at setup script. ... thing should not matter ... and file extension, ...
    (comp.programming)
  • Re: Create empty files?
    ... What of the following two variants is preferred? ... To create empty IDs files at setup script. ...
    (comp.programming)
  • Re: Create empty files?
    ... To create empty IDs files at setup script. ... If an IDs file is missing, treat it as if it would exist but empty. ... file system operations are expensive because they ...
    (comp.programming)
  • Create empty files?
    ... What of the following two variants is preferred? ... To create empty IDs files at setup script. ...
    (comp.programming)