Boost logo

Boost :

Subject: Re: [boost] bad include guards
From: Josh Juran (jjuran_at_[hidden])
Date: 2017-01-22 21:26:26


On Jan 22, 2017, at 10:18 PM, Larry Evans <cppljevans_at_[hidden]> wrote:

> On 01/22/2017 08:09 PM, Steven Watanabe wrote:
>
>> On 01/22/2017 07:55 PM, Larry Evans wrote:
>>
>>> Steven, do you have a program to detect files with identical
>>> include guards. I could you one at the moment :)
>>
>> I might be able to track down the program
>> I used for this, but it would probably be
>> faster to write it again from scratch. I
>> suspect that it was just a short perl script.
>
> OK. Thanks anyway :)
> I'll give it a try myself.

Consider verifying that the include guard macro name is properly derived from the file's pathname. That protects you when renaming a header (and also catches typos), and has a complexity of O(1) instead of O(n^2) over the number of headers.

Josh


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk