Sujet : Re: Writing own source disk
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.cDate : 04. Jun 2024, 01:35:25
Autres entêtes
Organisation : None to speak of
Message-ID : <87cyox1r5e.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5 6
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
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.
-- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.comvoid Void(void) { Void(); } /* The recursive call of the void */