Deutsch   English   Français   Italiano  
<87cyox1r5e.fsf@nosuchdomain.example.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: Writing own source disk
Date: Mon, 03 Jun 2024 17:35:25 -0700
Organization: None to speak of
Lines: 24
Message-ID: <87cyox1r5e.fsf@nosuchdomain.example.com>
References: <v3hmha$3banl$1@dont-email.me> <87sexvm1lr.fsf@bsb.me.uk>
	<v3iu4n$3i607$1@dont-email.me> <87mso2mky5.fsf@bsb.me.uk>
	<v3k49t$3rdhi$1@dont-email.me>
	<87h6e91r91.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Tue, 04 Jun 2024 02:35:25 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="90afdb6d92dd2740ec1db4216de117c0";
	logging-data="125771"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+gbgYOYgQLvxP3XzCnerYV"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:y99m6Z51vo1es4ld1RnSh50omSU=
	sha1:7R9eumgLeX8qKlQTDwE8R0FRu9U=
Bytes: 2089

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.com
void Void(void) { Void(); } /* The recursive call of the void */