Re: Writing own source disk

Liste des GroupesRevenir à l c 
Sujet : Re: Writing own source disk
De : david.brown (at) *nospam* hesbynett.no (David Brown)
Groupes : comp.lang.c
Date : 04. Jun 2024, 09:30:53
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v3mfrd$an45$2@dont-email.me>
References : 1 2 3 4 5 6 7
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0
On 04/06/2024 02:35, Keith Thompson wrote:
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
bart <bc@freeuk.com> writes:
[...]
I assume you can use __FILE__ with #embed? (I can do that with my
version of it).
>
Yes, but not reliably.
>
__FILE__ expands to "The presumed name of the current source file (a
character string literal)".  That's rather vague.
>
With gcc and clang, it expands to the file name argument given to the
compiler, or to the argument of the #include directive.  The running
program may or may not be able to access the source file using that
name.  The source file might not even exist when the program runs.
 I was thinking of using __FILE__ to access the source file at run time.
#embed is of course handled at compile time.  It's very likely, but
still not quite guaranteed, that `#embed __FILE__` will be able to
access the source file.
 
The key question for that will be directory handling.  If everything is being done within the same directory, than I'd expect "#embed __FILE__" to work fine.  But if you are calling the compiler from a different directory, specifying a path for the source file, that might not be reflected in __FILE__.  The result could vary between compilers.
There is also the possibility that the search path for #embed might result in finding a different file with the same name.  But I think that would probably need specific command-line switches to specify the #embed search path (again, this will be compiler-specific).

Date Sujet#  Auteur
2 Jun 24 * Writing own source disk43Malcolm McLean
3 Jun 24 +* Re: Writing own source disk32Ben Bacarisse
3 Jun 24 i+* Re: Writing own source disk9Malcolm McLean
3 Jun 24 ii+- Re: Writing own source disk1Lawrence D'Oliveiro
3 Jun 24 ii`* Re: Writing own source disk7Ben Bacarisse
4 Jun 24 ii `* Re: Writing own source disk6Malcolm McLean
4 Jun 24 ii  `* Re: Writing own source disk5Ben Bacarisse
4 Jun 24 ii   +- Re: Writing own source disk1Malcolm McLean
4 Jun 24 ii   `* Re: Writing own source disk3bart
5 Jun 24 ii    `* Re: Writing own source disk2Mikko
5 Jun 24 ii     `- Re: Writing own source disk1bart
3 Jun 24 i`* Re: Writing own source disk22bart
3 Jun 24 i +- Re: Writing own source disk1Malcolm McLean
3 Jun 24 i +- Re: Writing own source disk1Malcolm McLean
3 Jun 24 i `* Re: Writing own source disk19Ben Bacarisse
3 Jun 24 i  +* Re: Writing own source disk16bart
3 Jun 24 i  i+* Re: Writing own source disk7Ben Bacarisse
3 Jun 24 i  ii`* Re: Writing own source disk6bart
3 Jun 24 i  ii +- Re: Writing own source disk1bart
3 Jun 24 i  ii +* Re: Writing own source disk3Ben Bacarisse
3 Jun 24 i  ii i`* Re: Writing own source disk2bart
3 Jun 24 i  ii i `- Re: Writing own source disk1Ben Bacarisse
4 Jun 24 i  ii `- Re: Writing own source disk1Malcolm McLean
4 Jun 24 i  i`* Re: Writing own source disk8Keith Thompson
4 Jun 24 i  i `* Re: Writing own source disk7Keith Thompson
4 Jun 24 i  i  +- Re: Writing own source disk1David Brown
5 Jun 24 i  i  `* Re: Writing own source disk5Mikko
5 Jun 24 i  i   +- Re: Writing own source disk1Lawrence D'Oliveiro
5 Jun 24 i  i   `* Re: Writing own source disk3Keith Thompson
5 Jun 24 i  i    `* Re: Writing own source disk2Keith Thompson
5 Jun 24 i  i     `- Re: Writing own source disk1David Brown
4 Jun 24 i  `* Re: Writing own source disk2Lawrence D'Oliveiro
4 Jun 24 i   `- Re: Writing own source disk1Ben Bacarisse
3 Jun 24 +- Re: Writing own source disk1Lawrence D'Oliveiro
3 Jun 24 `* Re: Writing own source disk9Michael S
3 Jun 24  `* Re: Writing own source disk8Ben Bacarisse
4 Jun 24   `* Re: Writing own source disk7Malcolm McLean
4 Jun 24    `* Re: Writing own source disk6Ben Bacarisse
4 Jun 24     `* Re: Writing own source disk5Malcolm McLean
4 Jun 24      +- Re: Writing own source disk1Richard Harnden
6 Jun 24      `* Re: Writing own source disk3Ben Bacarisse
6 Jun 24       `* Re: Writing own source disk2Malcolm McLean
7 Jun 24        `- Re: Writing own source disk1Ben Bacarisse

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal