C++ Logo

sg15

Advanced search

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

From: Peter Dimov <pdimov_at_[hidden]>
Date: Mon, 25 Apr 2022 20:03:47 +0300
Gabriel Dos Reis wrote:
> [Peter]
> > All that's also true without modules, but we still make it possible
> > for
> >
> > c++ hello.cc
> >
> > to produce a working hello world executable without the user
> > explicitly providing a bunch of -I, -L, -l options, or having to build
> > the standard library first.
>
> Show me the content of hello.cc and we see if this audience agrees on the
> requirements.

In this specific message I had the following hello.cc programs in mind:

(1)

#include <iostream>

int main()
{
    std::cout << "Hello, world" << std::endl;
}

(2)

import <iostream>;

int main()
{
    std::cout << "Hello, world" << std::endl;
}

(3)

import std;

int main()
{
    std::cout << "Hello, world" << std::endl;
}

You are correct that the requests don't stop here. Given that

(4)

#include <boost/smart_ptr.hpp>

int main()
{
    boost::shared_ptr<int> p( new int );
}

works today after `apt install libboost-dev`, I would also prefer for

(5)

import <boost/smart_ptr.hpp>;

int main()
{
    boost::shared_ptr<int> p( new int );
}

to work. And given that

(6)

#include <boost/regex.hpp>

int main()
{
    boost::regex r;
}

works today (after `apt install` and appending `-lboost_regex` to the
command line), ideally, I would also prefer for

(7)

import <boost/regex.hpp>;

int main()
{
    boost::regex r;
}

or

(8)

import boost.regex;

int main()
{
    boost::regex r;
}

to work (after `apt install` and possibly, but not necessarily, after appending
something containing `boost_regex` on the command line.)

Now, obviously, I don't necessarily insist that all of these _must_ work. I'm
giving them as a reference so that any of us can state which of these need,
in his/her opinion, work, and which do not have to.

Myself, I would prefer all of these to work. In 202x, we want programmers
to write the module-using programs, and not the "legacy" ones. But it's a
tradeoff.

Received on 2022-04-25 17:03:52