#pragma once

#pragma once

/* ... */


or

#ifndef HEADERNAME_H_
#define HEADERNAME_H_

/* ... */

#endif // HEADERNAME_H_

Attached: include_guard.jpg (367x684, 64K)

Other urls found in this thread:

ourmachinery.com/post/physical-design/
twitter.com/SFWRedditGifs

Our lord and saviour would of wanted #ifndef. Probably

Attached: 1547403039846.gif (200x234, 2.85M)

Pragma once, it's current year

I make a combo of both

>would of

Attached: meme1.jpg (567x390, 16K)

Neither, instead meticulously and complicatedly make sure you never include one document in more than one file.

Attached: 12395.png (500x347, 150K)

You mean the plan9 style?
ourmachinery.com/post/physical-design/

#pragma once

Less attention to detail than method 2 but its more concise and still gets the job done fine at a practical level.

Like:
#pragma once

#ifndef header
#define header
//stuff
#endif

#pragma once is good but if you are compiling from an old compiler it can cause you errors, so for code portability..

Didnt think of portability but youre right. Still thats always a concern with newer features.

Holy shit. Thank god I don't write C/C++ anymore. This is just so fucking disgusting.

for(std::vector::iterator it = v.begin(); it != v.end(); ++it) {
std::cout

using namespace std;
for (auto i = v.begin(); i != v.end() ++i) {
cout

Oh yeah I remember writing shit like that. Now I can do
v.forEach { println(it) }

Don't blame master language anymore you
heathen

for (auto& x : v)
{
std::cout

Use
for(const auto& s : v)

>would of
>could of
>i could not of care less
i swear britbongs and burgers don't understand their own language

>tfw you wrote C++ professionally for so long shit like this isnt even difficult to understand

Wish the standards comittee didnt shit things up so bad. I still think anyone writing C++ should treat it simply as "C With Classes" and they will be much happier for it.

Nah it’s niggerlicious, look at what he has to say about std::cout

Header guard. pragma once isn't standard and non-portable; it will probably work most of the time, until it doesn't. Header guards are clunky but reliable.

Use a sane programming language. This is the kind of bullshit that the implementation should take care of, not the programmer herself.

std::for_each(v.begin(), v.end(), [](const auto& s) { std::cout

Imagine being a python programmer

Imagine believing languages older than C didn't already solve this problem.
Do you unironically think having to use #pragma or #include guards is something for "real programmers"?

Why do you even care? It's autogenerated by just about any editor.

Headers are copy paste, how else would you solve it brainiac

>in b4 muh module system
Yeah well then it's not copy paste anymore now is it

And you think copy/paste is a good thing?

Yes

In all header files
#pragma once

Then with a global header which includes all headers.

In all .c files only need
#include globalhead.h

> pro tips

Attached: 1523872943555.png (500x283, 24K)