By the way, why don't _Pragma and #line support concatenating multiple strings in their respective string parameters?
#define RAW_TOKENS_PRAGMA2
(...) _Pragma(#__VA_ARGS__)
#define RAW_TOKENS_PRAGMA(...) RAW_TOKENS_PRAGMA2(__VA_ARGS__)
It has been determined that it is more difficult to implement than you would think:http://stackoverflow.com/questions/23696115/is-pragma-once-part-of-the-c11-standard
The Modules proposal aims to solve the problems of include files in a better way:--Chet
Could we then define _Pragma as taking one or more string parameters (not separated by anything but possibly whitespace) that are interpreted concatenated?
It has been determined that it is more difficult to implement than you would think:http://stackoverflow.com/questions/23696115/is-pragma-once-part-of-the-c11-standardThe Modules proposal aims to solve the problems of include files in a better way:
On Tuesday 21 October 2014 19:01:36 Myriachan wrote:
> Sure, but that's years off if ever, and there are billions of lines of code
> in projects using #pragma once now.
So why do we need to change anything? If that code is already working, it's
Well, there's value to having de facto standards match the de jure standard. See exported templates and their eventual removal as an example specific to C++. It's unfortunate when large codebases depend on a non-standard feature that "works" but is non-standard and then new tools that more closely follow the standard without extensions can't handle the codebase. Happens all the time with game engines in my experience, including specifically #pragma once issues.
That said, #pragma once couldn't be added to the standard any sooner than C++17, and #pragma once _isn't_ a de facto standard because different implementations work differently, and there's the problems with complex source directories Bo mentions, and... I think all the reasons why this won't work were already clearly enumerated in the last thread on this very topic that came up some months ago.
#ifndef CSCWRITER_H_
# define CSVWRITER_H_
"It's complicated to implement from a compiler point of view so let the programmer type a lot of super-murphy piece of code instead.
then what do people think would be the effort (in days) to convert the project itself to use that extension... (i.e. add the keywords where the default #once doesn't work)?
then what do people think would be the effort (in days) to convert the project itself to use that extension... (i.e. add the keywords where the default #once doesn't work)?
Hypothetical:Ignoring compatibility problems....imagine if #pragma once was the default and some other kind of statement existed to change the default where needed e.g. #pragma multiple or even #include multiple <x>....Now imagine if something like this extension was implemented in clang...First, what to people think would be the effort (in days) to implement that change in the clang compiler itself (i.e. to support the new semantics and keywords),?
then what do people think would be the effort (in days) to convert the project itself to use that extension... (i.e. add the keywords where the default #once doesn't work)?
then finally what do people think would be the speed up (in % build time), if clang (or any project like it) were compiled using that extensions?
On Wednesday, October 22, 2014 8:29:21 AM UTC+13, Myriachan wrote:I think that #pragma once should be standardized - at least partially/optionally/conditionally-supported. Every major compiler implements it with identical or nearly-identical semantics.
Defining what it means for a file to be a repeat is rather simple: On platforms supporting symlinks and hard links, use unique inode numbers (+ device if needed). On other platforms, use the filename. Compilers may assume that files don't change while compiling (i.e. if the filename matches, it can be assumed to be identical). On platforms where there exist special links to the same or parent directory, like "./" or "../" on NT and POSIX, this assumption can be extended to collapse these.
By the way, why don't _Pragma and #line support concatenating multiple strings in their respective string parameters?
Melissa
--
On Thu, Oct 30, 2014 at 4:54 PM, <gmis...@gmail.com> wrote:Hypothetical:Ignoring compatibility problems....imagine if #pragma once was the default and some other kind of statement existed to change the default where needed e.g. #pragma multiple or even #include multiple <x>....Now imagine if something like this extension was implemented in clang...First, what to people think would be the effort (in days) to implement that change in the clang compiler itself (i.e. to support the new semantics and keywords),?Small (a day or so).then what do people think would be the effort (in days) to convert the project itself to use that extension... (i.e. add the keywords where the default #once doesn't work)?Small (a day or so; we have a lot of textually-included headers, and we build tools that generate headers, all of which would need to be updated).then finally what do people think would be the speed up (in % build time), if clang (or any project like it) were compiled using that extensions?I would not expect any measurable difference. We already detect include guards and get all the performance benefits of #pragma once from them.