🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #508

Re: strange filenames in __FILE__ macro

#508
From: david.f.prosser
Date: Mon, 28 Aug 1989 19:01
22 lines
1627 bytes
In article <26208@gumby.mips.COM> lai@mips.COM (David Lai) writes:
>Does the standard specify what characters are legal for a filename.
>Specifically, when the __FILE__ macro is expanded, does the preprocessor
>have to perform special excape sequence translations.
>
>As an example, in MS-DOS systems the '\' character is prevalent in pathnames,
>does each '\' in the pathname get translated to '\\' when expanding __FILE__?
>
>How about filenames with '"' or "'" or non-printing characters?

__FILE__ must be replaced with a valid character string literal.  Since
#include "..." is not necessarily a valid character string literal, and
since these two are most likely related (in a "quality" implementation),
the presumption is that the implementation should produce a string
literal that, when printed at runtime, will "look like" the name of the
source file.  Thus troublesome characters like backslash, new-line,
double-quote, etc. should be generated by escape sequences.

Of course this is all a "quality of implementation" issue: the presumed
name of the source file could always be "stdin" or ""!

Dave Prosser	...not an official X3J11 answer...
Technical Details
Message-ID: <1660@cbnewsl.ATT.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!att!cbnewsl!dfp
References: <26208@gumby.mips.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!att!cbnewsl!dfp
From: dfp@cbnewsl.ATT.COM (david.f.prosser)
Newsgroups: comp.std.c
Subject: Re: strange filenames in __FILE__ macro
Message-ID: <1660@cbnewsl.ATT.COM>
Date: 28 Aug 89 19:01:20 GMT
References: <26208@gumby.mips.COM>
Reply-To: dfp@cbnewsl.ATT.COM (david.f.prosser)
Organization: AT&T Bell Laboratories
Lines: 22