[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Can't find includes to silence warnings
On Sunday, March 3, 2002, at 11:00 AM, Matt Watson wrote:
>> Why is it necessary to avoid #import in this case?
>
> It's not necessary to avoid it, it's just not as efficient to use it,
> since the multiple-include issue is already taken care of in the header
> directly, so using #import is redundant.
Actually, I'd say that the #import is more efficient since you don't
need to open the .h file again, read the whole thing and end up ignoring
it because it is all #if'ed out. Is there some compiler magic that
records compiler guards and turns them into the same thing that #import
does?
I'd really rather see people use '#pragma once' than include guards
since that is the best of both worlds -- the header file itself defineds
whether it should be included more than once and the compiler can easily
remember this fact rather than having to reprocess the header each time
it is redundantly included.
-tim