Monday, July 25, 2016

Digest for comp.lang.c++@googlegroups.com - 11 updates in 5 topics

Paavo Helde <myfirstname@osa.pri.ee>: Jul 25 09:12PM +0300

> from main.cpp:1:
> Sub.h:4:7: error: previous definition of 'class Sub'
> class Sub : public Base {
 
You need to protect your header files against multiple inclusion.
Nowadays in practice it is just OK to put in the start of each header file:
 
#pragma once
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Jul 25 09:56PM +0200

On 25.07.2016 21:14, Jerry Stuckle wrote:
 
> Just beware that not all compilers support #pragma once.
 
There is a list in Wikipedia.
 
In practice, a compiler that doesn't support `#pragma once` is one that
quite likely also has many other quirks, i.e. not a good idea to use it.
 
 
>

No comments: