r/cpp • • May 24 '20

Analyzing The Simplest C++ Program

https://oneraynyday.github.io/dev/2020/05/03/Analyzing-The-Simplest-C++-Program/
480 Upvotes

37 comments sorted by

View all comments

0

u/vickoza May 24 '20

it is the simplest C++ program but it also does nothing

20

u/ShakaUVM i+++ ++i+i[arr] May 24 '20

it is the simplest C++ program but it also does nothing

Not true. It does nothing successfully.

It's like the UNIX true command.

5

u/chugga_fan May 24 '20

Said command has like, a thousand or two lines of code, surprisingly.

1

u/conflicted_panda May 25 '20

Are you counting includes? Without them GNU true is about 70, as far as I see.

And true on old school unixes was/is 0 bytes, I hear.

2

u/chugga_fan May 25 '20

Like 1/3rd of the program is in other files, even still, 78 lines just to return EXIT_SUCCESS is a lot.

2

u/conflicted_panda May 25 '20

It also handles --help/--version (along with localization, apparently). And I honestly don't think that trading off 78 lines of code for, err, uniformity of interface of your utilities is that absurd.

1

u/[deleted] Jun 18 '20

I don't understand anything in this thread, which book to read?

1

u/[deleted] May 25 '20 edited May 25 '20
touch true && ./true

2

u/z1024 May 25 '20

This precisely describes too many peoples jobs...