Tuesday, December 11, 2018

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

Juha Nieminen <nospam@thanks.invalid>: Dec 11 01:06PM

> on definitions or declarations from that file. I don't want multiple
> inclusion to be an error - I want it to work safely. That's what
> standard include guards do.
 
Yeah, the proposed solution isn't good for guarding against recursive
inclusion as it stops the same header from being included more than
once (which easily happens, and is not an error nor even bad design).
 
There is a way to detect recursive inclusion, but you need additional
defines to do that. Something like:
 
#ifdef A_H_RECURSION_GUARD
#error "a.h is being recursively included"

No comments: