C++ Logo

sg15

Advanced search

Re: [isocpp-ext] Can we expect that all C++ source files can have the same suffix?

From: Nicolai Josuttis <nico_at_[hidden]>
Date: Thu, 14 Apr 2022 06:25:11 +0200
Thanks for the hint to that note. That was helpful.

So, a compiler allowing same suffix and same command line options is
standard conforming
and a compiler not allowing that also is.
Whether C++ files are required to have different file suffixes or
command line options is a pure quality of implementation.


Am 13.04.2022 um 23:41 schrieb Ville Voutilainen:
> On Wed, 13 Apr 2022 at 23:58, Nicolai Josuttis via Ext
> <ext_at_[hidden]> wrote:
>> I wonder whether the behavior of VC++ is standard conforming.
> The wondering is ill-formed. The C++ standard requires no files, and
> by extension no particular file extensions, and allows
> for all imaginable variations thereof, all-files,
> some-files+something-else, no-files-at-all, etc.. See [lex.phases]/7,
> and the explanatory
> "[Note 2 : Source files, translation units and translated translation
> units need not necessarily be stored as files,
> nor need there be any one-to-one correspondence between these entities
> and any external representation. The
> description is conceptual only, and does not specify any particular
> implementation. — end note]"
>
> The standard leaves it completely unspecified how you provide your
> program source to your implementation, and
> an implementation can decide any which way it likes to facilitate
> that. And that's by design. If you have an online compiler,
> it doesn't necessarily use any files. If you feed source code to
> 'intellisense' for analysis, it doesn't necessarily use any files.
> There is a (albeit partial) C++ implementation inside Qt Creator, for
> code analysis, and it doesn't use files. But nevertheless,
> if an implementation decides that you need to feed in metadata about a
> source unit via command-line options, it's perfectly
> conforming to do so. Such as, by saying "for source code such-and-such
> to be compiled so-and-so, pass /interface".
>
> You can certainly propose recommendations to be given by SG15. But an
> SC22 programming language standard cannot
> mandate how the tooling-interfaces or user-interfaces of the
> implementations of the language are implemented, that's out of the
> scope.

-- 
--- 
Nicolai M. Josuttis
www.josuttis.de
+49 (0)531 / 129 88 86
+49 (0)700 / JOSUTTIS
Books:
 C++: http://cppstd20.com, http://cppstd17.com, http://cppmove.com,
      http://cppstdlib.com, http://tmplbook.com

Received on 2022-04-14 04:25:19