Liste des Groupes | Revenir à cl c |
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes: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.bart <bc@freeuk.com> writes:I was thinking of using __FILE__ to access the source file at run time.
[...]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.
#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.
Les messages affichés proviennent d'usenet.