On Wed, Jan 28, 2009 at 12:21 PM, Chris Lattner <clatt...@apple.com> wrote:
>
> On Jan 28, 2009, at 11:51 AM, H.J. Lu wrote:
>
>> Hi,
>>
>> I got a request to try "FOO.H" if foo.h doesn't exist when dealing
>> with
>>
>> #include "foo.h"
>>
>> Any comments?
>
> I strongly recommend against this, unless this is only a "last chance" fall
> back.
>
> From a performance standpoint, if you have -Idir1 -Idir2 -Idir3, you don't
> want to stat all variants of "foo.h" in dir1 before moving on to dir2.  If
> you do a full search for foo.h in all appropriate search paths, and then
> redo it only on failure, then the performance issue goes away.  However, in
> that  case you get very difficult to explain behavior if you have multiple
> files with spelling variants of foo.h in different search paths.
>

I won't stat all variants of "foo.h". I think scandir will work here and
this feature will be supported only if scandir is available.

-- 
H.J.

Reply via email to