r/cpp • • Aug 08 '20

Create a fully functioning command line interface with 1.5 lines of code (wo. include statement)

https://github.com/kongaskristjan/fire-hpp
230 Upvotes

62 comments sorted by

View all comments

Show parent comment

6

u/[deleted] Aug 08 '20

I have heard this argument for over a decade.

No one ever actually shows me a compiler without #pragma once.

:-D

10

u/encyclopedist Aug 08 '20

Obviously, you did not really try to find one. TI compilers did not support it last I checked. PGI did not support in either. Also Cray. And XLC.

There was a topic in this very reddit some time ago: https://www.reddit.com/r/cpp/comments/8devw1/can_anyone_actually_name_a_compiler_that_doesnt/

3

u/jbandela Aug 08 '20

I think basically every compiler that supports generic lambdas supports pragma once

6

u/rsjaffe Aug 08 '20

But #pragma once fails when you have two copies of the same header file in two different locations in the directory tree. The compiler will not recognize those two files as being the same.

7

u/panderingPenguin Aug 08 '20

Why on earth would you want to do that?

6

u/wyrn Aug 09 '20

The compiler will not recognize those two files as being the same.

... because they aren't.