Re: Word For Today: “Uglification”

Liste des GroupesRevenir à l c 
Sujet : Re: Word For Today: “Uglification”
De : 433-929-6894 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.lang.c
Date : 13. Mar 2024, 04:53:26
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240312172439.206@kylheku.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2024-03-12, bart <bc@freeuk.com> wrote:
On 12/03/2024 18:50, Kaz Kylheku wrote:
On 2024-03-12, bart <bc@freeuk.com> wrote:
>
>
I tried my C compiler with a couple of open source projects recently
that both failed for the same mysterious reason.
>
It turned out that one of them used this line:
>
      #include "string.h"
>
and the other used:
>
      #include "malloc.h"
 
In the TXR project, I have a "signal.h" header, which must not resolve
to <signal.h>. I also have "time.h" and "termios.h", "glob.h",
"regex.h", "alloca.h".
 
Choosing header names that are distinct from an implementation's
headers is:
 
1) unnecessary due the local-first search strategy of #include "..."
 
2) a fool's errand.
>
It's confusing. So "string.h" means the standard header, so it is the
same as <string.h>, unless it happens to find a file called string.h
amongst the project files.

It's not confusing at all. In projects under my control, you would
never see #include "string.h" where the intent is to include <string.h>.
It is a lousy practice.

That is undesirable, unless you specifically want to shadow the standard
headers. In the examples I saw, that was not the case.

You cannot shadow the standard headers when they are correctly included
using #include <...>, unless you resort to compiler specific tricks,
like reconfiguring the <...> search to look in a specified directory.
>
>
Regarding (2), no name that you choose is guaranteed not to be identical
to something in the implementation! Suppose I panic and rename
my "time.h" to "foo.h".  Who is to say that some implementation doesn't
have a <foo.h> header?
>
The C implementation? Surely that will list all the system headers that
it provides; it looks quite easy to avoid a clash!

But there is no clash to avoid. A local header file that accidentally
has the same name as something in your /usr/include or whatever
is no problem at all, if you refer to it using #include "...".

But if there were a clash to be avoided, it would be tricky.

Not all headers are documented, so you would have to actually go looking
into the header file installation.

The information there is no reliable for portability, because all you
learn is what files are present in that installation.

There is no such rule that when you name a "whatever.h", you must
ensure there does not exist a <whatever.h>.
>
You mean that programs should be allowed to do this:
>
     #include <string.h>
     #include "string.h"

No I mean, that programs /are/.

With the two headers doing totally different things.
>
I can guess the reasons why such a rule doesn't exist, because so many
programs just carelessly used "..." instead of <...>, and they would all
break if it was imposed.

Those programs don't break, because if "string.h" doesn't exist,
then it is re-tried as if it were <string.h> (effectively).

(I don't think it's the best design; it would be better if "..."
and <...> looked in separate places with no fallback from one
to the other, such that #include "stdio.h" programs not
referencing a local file would break.)

So, is that /your/ file termios.c, or the one that implements the POSIX
termios code?

Since my project isn't an operating system, or library for one,
but a dynamic language runtime, it has to be the former.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Date Sujet#  Auteur
12 Mar 24 * Word For Today: “Uglification”63Lawrence D'Oliveiro
12 Mar 24 +* Re: Word For Today: “Uglification”3Keith Thompson
12 Mar 24 i`* Re: Word For Today: “Uglification”2Lawrence D'Oliveiro
12 Mar 24 i `- Re: Word For Today: “Uglification”1Keith Thompson
12 Mar 24 +* Re: Word For Today: “Uglification”11Kaz Kylheku
14 Mar 24 i`* Re: Word For Today: “Uglification”10Tim Rentsch
14 Mar 24 i `* Re: Word For Today: “Uglification”9Keith Thompson
15 Mar 24 i  +* Re: Word For Today: “Uglification”2Keith Thompson
15 Mar 24 i  i`- Re: Word For Today: “Uglification”1David Brown
15 Mar 24 i  +* Re: Word For Today: “Uglification”5Keith Thompson
15 Mar 24 i  i`* Re: Word For Today: “Uglification”4Keith Thompson
15 Mar 24 i  i `* Re: Word For Today: “Uglification”3Kaz Kylheku
15 Mar 24 i  i  `* Re: Word For Today: “Uglification”2Keith Thompson
15 Mar 24 i  i   `- Re: Word For Today: “Uglification”1David Brown
15 Mar 24 i  `- Re: Word For Today: “Uglification”1Tim Rentsch
12 Mar 24 +* Re: Word For Today: “Uglification”47James Kuyper
12 Mar 24 i`* Re: Word For Today: “Uglification”46Lawrence D'Oliveiro
12 Mar 24 i +- Re: Word For Today: “Uglification”1Lawrence D'Oliveiro
12 Mar 24 i +* Re: Word For Today: “Uglification”37Kaz Kylheku
12 Mar 24 i i`* Re: Word For Today: “Uglification”36Richard Kettlewell
12 Mar 24 i i +* Re: Word For Today: “Uglification”22David Brown
12 Mar 24 i i i+* Re: Word For Today: “Uglification”20Anton Shepelev
12 Mar 24 i i ii`* Re: Word For Today: “Uglification”19bart
12 Mar 24 i i ii +* Re: Word For Today: “Uglification”17Anton Shepelev
12 Mar 24 i i ii i`* Re: Word For Today: “Uglification”16bart
12 Mar 24 i i ii i `* Re: Word For Today: “Uglification”15Kaz Kylheku
13 Mar 24 i i ii i  `* Re: Word For Today: “Uglification”14bart
13 Mar 24 i i ii i   +* Re: Word For Today: “Uglification”12Keith Thompson
13 Mar 24 i i ii i   i+* Re: Word For Today: “Uglification”10bart
13 Mar 24 i i ii i   ii+* Re: Word For Today: “Uglification”7Michael S
13 Mar 24 i i ii i   iii+* Re: Word For Today: “Uglification”4Keith Thompson
13 Mar 24 i i ii i   iiii`* Re: Word For Today: “Uglification”3David Brown
13 Mar 24 i i ii i   iiii `* Re: Word For Today: “Uglification”2Keith Thompson
13 Mar 24 i i ii i   iiii  `- Re: Word For Today: “Uglification”1David Brown
13 Mar 24 i i ii i   iii+- Re: Word For Today: “Uglification”1David Brown
13 Mar 24 i i ii i   iii`- Re: Word For Today: “Uglification”1Kaz Kylheku
13 Mar 24 i i ii i   ii`* Re: Word For Today: “Uglification”2Keith Thompson
13 Mar 24 i i ii i   ii `- Re: Word For Today: “Uglification”1bart
13 Mar 24 i i ii i   i`- Re: Word For Today: “Uglification”1Nick Bowler
13 Mar 24 i i ii i   `- Re: Word For Today: “Uglification”1Kaz Kylheku
12 Mar 24 i i ii `- Re: Word For Today: “Uglification”1Kaz Kylheku
13 Mar 24 i i i`- Re: Word For Today: “Uglification”1Blue-Maned_Hawk
13 Mar 24 i i `* Re: Word For Today: “Uglification”13Lawrence D'Oliveiro
13 Mar 24 i i  +* Re: Word For Today: “Uglification”11Keith Thompson
13 Mar 24 i i  i`* Re: Word For Today: “Uglification”10Richard Kettlewell
13 Mar 24 i i  i `* Re: Word For Today: “Uglification”9Keith Thompson
13 Mar 24 i i  i  +* Re: Word For Today: “Uglification”7Lawrence D'Oliveiro
14 Mar 24 i i  i  i+- Re: Word For Today: “Uglification”1Kaz Kylheku
14 Mar 24 i i  i  i+- Re: Word For Today: “Uglification”1Keith Thompson
14 Mar 24 i i  i  i`* Re: Word For Today: “Uglification”4Lawrence D'Oliveiro
14 Mar 24 i i  i  i `* Re: Word For Today: “Uglification”3Keith Thompson
14 Mar 24 i i  i  i  +- Re: Word For Today: “Uglification”1Richard Kettlewell
14 Mar 24 i i  i  i  `- Re: Word For Today: “Uglification”1Kaz Kylheku
19 Jun 24 i i  i  `- Re: Word For Today: “Uglification”1Tim Rentsch
13 Mar 24 i i  `- Re: Word For Today: “Uglification”1Kaz Kylheku
12 Mar 24 i `* Re: Word For Today: “Uglification”7James Kuyper
12 Mar 24 i  `* Re: Word For Today: “Uglification”6Lawrence D'Oliveiro
13 Mar 24 i   +- Re: Word For Today: “Uglification”1Keith Thompson
13 Mar 24 i   `* Re: Word For Today: “Uglification”4James Kuyper
13 Mar 24 i    `* Re: Word For Today: “Uglification”3Lawrence D'Oliveiro
14 Mar 24 i     +- Re: Word For Today: “Uglification”1Kaz Kylheku
14 Mar 24 i     `- Re: Word For Today: “Uglification”1James Kuyper
12 Mar 24 `- Re: Word For Today: “Uglification”1Kaz Kylheku

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal