Quantcast
Channel: Comments on: 1.10 — A first look at the preprocessor
Browsing all 155 articles
Browse latest View live

By: Trophy

Wouldn’t you not need to add the header guards in add.h and subtract.h since the issue is with mymath.h being called twice and not the other two? Or is this just good form?

View Article



By: YamNahar

At this step #define MY_NAME “Alex” cout << "Hello, " << MY_NAME << endl; i get 2 errors: error C2143: syntax error : missing ';' before '<<' error C4430: missing type specifier...

View Article

By: Constants | 4sharesite

[...] avoid using literal constants that aren’t 0 or 1. For more detail, you can review the section on magic numbers, and why they are a bad [...]

View Article

By: Header files | 4sharesite

[...] two parts. The first part is called a header guard, which is discussed in the next lesson (on the preprocessor). The second part is the actual content of the .h file, which should be the...

View Article

By: 1.9 — Header files « kickasscomputing

[...] two parts. The first part is called a header guard, which is discussed in the next lesson (on the preprocessor). The second part is the actual content of the .h file, which should be the...

View Article


By: Header files « Learn C++ Programming

[...] two parts. The first part is called a header guard, which is discussed in the next lesson (on the preprocessor). The second part is the actual content of the .h file, which should be the...

View Article

By: Constants « Learn C++ Programming

[...] avoid using literal constants that aren’t 0 or 1. For more detail, you can review the section on magic numbers, and why they are a bad [...]

View Article

By: artxworks

//mymath.h #ifndef MYMATH_H #define MYMATH_H // your declarations here #endif add.h #ifndef ADD_H #define ADD_H #include "mymath.h" int add(int x, int y); #endif subtract.h #ifndef SUBTRACT_H #define...

View Article


By: artxworks

//mymath.h #ifndef MYMATH_H #define MYMATH_H // your declarations here #endif add.h #ifndef ADD_H #define ADD_H #include "mymath.h" int add(int x, int y); #endif subtract.h #ifndef SUBTRACT_H #define...

View Article


By: Maverick95

I’m failing to see why I need to use header guards with the IDE that I’m using. The code below I’ve used in Microsoft Visual C++ 2010 Express and it compiles without any complaints or errors....

View Article

By: C++ Tutorials | 1.9 — Header files

[...] two parts. The first part is called a header guard, which is discussed in the next lesson (on the preprocessor). The second part is the actual content of the .h file, which should be the...

View Article

By: C++ Tutorials 2.8 — Constants | C++ Tutorials

[...] avoid using literal constants that aren’t 0 or 1. For more detail, you can review the section on magic numbers, and why they are a bad [...]

View Article

By: markdj

I don’t know if there’s another benefit, but it does let you and anyone else looking at the code that it’s a constant and not going to be able to be changed throughout the program.

View Article


By: Why can't a compiler avoid importing a header file twice by its own? |...

[...] New to C++! So I was reading this: http://www.learncpp.com/cpp-tutorial/110-a-first-look-at-the-preprocessor/ [...]

View Article

By: Learner

#include directives like these are also valid: #include “dir/file.h” #include “../file.h”

View Article


By: dice3000

I believe that [ #pragma once ] serves the same purpose as header guards

View Article

By: 1.9 — Header files | Tumbu

[...] two parts. The first part is called a header guard, which is discussed in the next lesson (on the preprocessor). The second part is the actual content of the .h file, which should be the...

View Article


By: 2.8 — Constants | Tumbu

[...] avoid using literal constants that aren’t 0 or 1. For more detail, you can review the section on magic numbers, and why they are a bad [...]

View Article

By: zingmars

The #ifndef ensures that everything required is initialized once and no more. When you load it the second time, the compiler sees that the variables and whatnot have been declared, so it does nothing.

View Article

By: isomorphismes

Thanks so much for these tutorials. Wish I had found them years ago. So many basic things that I needed to understand the C++ examples I was reading at the time. You present at a good level of...

View Article
Browsing all 155 articles
Browse latest View live




Latest Images