Re: Create empty files?



Victor Porton <porton.victor@xxxxxxxxx> writes:

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?

We cannot answer to your first question without answering first to
your second question.

If you tried to answer to your second question, the answer to your
first question would become obvious, because the semantics of the two
options of the first question are different. (Ask yourself the
question of what should occur when the file is missing, in the first
case, or ask yourself what difference it makes if the file exists or
doesn't exist in the second case).


--
__Pascal Bourguignon__ http://www.informatimago.com/
.



Relevant Pages

  • Re: Create empty files?
    ... Because empty files are not "empty" as far as the directory is ... A directory block can typically only hold 512 entries. ... from observing some clown who put thousands of files into a single ... A few bytes of free space isn't a concern for the particular ...
    (comp.programming)
  • Re: Directory date of 12/30/1979
    ... There are freeware tools to allow a date to be changed on a file or ... They are empty, but this was back when our company ... I do not understand your second question "It was not a tool to ... - please rephrase. ...
    (microsoft.public.windows.server.general)
  • Re: Directory date of 12/30/1979
    ... They are empty, but this was back when our company ... still used pencil and paper. ... I do not understand your second question "It was not a tool to ... - please rephrase. ...
    (microsoft.public.windows.server.general)
  • Re: Directory date of 12/30/1979
    ... They are empty, but this was back when our company ... still used pencil and paper. ... I do not understand your second question "It was not a tool to ... - please rephrase. ...
    (microsoft.public.windows.server.general)
  • Re: few confusing things about Full-Text Search queries
    ... Never mind about my second question. ... I assumed thesaurus file was ... already filled with synonyms, but as it turned out it's empty and ...
    (microsoft.public.sqlserver.programming)