Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > The case insensitive #include statement horror...

Reply
Thread Tools

The case insensitive #include statement horror...

 
 
Stephan Kuhagen
Guest
Posts: n/a
 
      11-29-2006
Hello

Please forgive me, if this is the wrong NG, since this is a compiler
specific C++-Question:

I'm managing a huge build system for multiple platforms (Win*, Linux,
MacOSX). Most of our programmers work on Windows and seem to be unable to
learn the difference between upper and lower case characters in #include.
So most time the thing works on Windows, but fails on the others. Although
they get mails when a project fails, the errors either do not get fixed or
they re-appear after every change... This is _really annoying_ ! - Does
anyone here know a switch or trick to make the Microsoft-Compilers (VC6 and
up) case-sensitive in #include-statements and throw an error on wrong case?

"Thanks for not shooting me"
Regards
Stephan Kuhagen

 
Reply With Quote
 
 
 
 
Ondra Holub
Guest
Posts: n/a
 
      11-29-2006

Stephan Kuhagen napsal:
> Hello
>
> Please forgive me, if this is the wrong NG, since this is a compiler
> specific C++-Question:
>
> I'm managing a huge build system for multiple platforms (Win*, Linux,
> MacOSX). Most of our programmers work on Windows and seem to be unable to
> learn the difference between upper and lower case characters in #include.
> So most time the thing works on Windows, but fails on the others. Although
> they get mails when a project fails, the errors either do not get fixed or
> they re-appear after every change... This is _really annoying_ ! - Does
> anyone here know a switch or trick to make the Microsoft-Compilers (VC6 and
> up) case-sensitive in #include-statements and throw an error on wrong case?
>
> "Thanks for not shooting me"
> Regards
> Stephan Kuhagen


Hi. I was dealing with the same problem too. But it is not problem of
compiler, it is problem of filesystem, because on FAT or NTFS are
always files, which differ only in upper/lower case letters, treated as
same files. You can try it with gcc on Windows, there is the same
problem.

 
Reply With Quote
 
 
 
 
Stephan Kuhagen
Guest
Posts: n/a
 
      11-29-2006
Ondra Holub wrote:

> Hi. I was dealing with the same problem too. But it is not problem of
> compiler, it is problem of filesystem, because on FAT or NTFS are
> always files, which differ only in upper/lower case letters, treated as
> same files. You can try it with gcc on Windows, there is the same
> problem.


Yes, I know. But since Windows is able to show the filenames in correct case
in the Explorer or even with dir in the console, I thought (desperately
hoped...) there may be a switch in the MS compilers or an obscure pragma to
make them check the spelling...

Regards
Stephan
 
Reply With Quote
 
Ondra Holub
Guest
Posts: n/a
 
      11-29-2006

Stephan Kuhagen napsal:
> Ondra Holub wrote:
>
> > Hi. I was dealing with the same problem too. But it is not problem of
> > compiler, it is problem of filesystem, because on FAT or NTFS are
> > always files, which differ only in upper/lower case letters, treated as
> > same files. You can try it with gcc on Windows, there is the same
> > problem.

>
> Yes, I know. But since Windows is able to show the filenames in correct case
> in the Explorer or even with dir in the console, I thought (desperately
> hoped...) there may be a switch in the MS compilers or an obscure pragma to
> make them check the spelling...
>
> Regards
> Stephan


I would have one (obscure) solution. I do not know, which versioning
system are you using. Some of versioning systems allow run some script
during checking-in new version of source. Such script may perform some
checks or modifications of file being checked-in (adding change log,
etc.). I think in ClearCase is possible to decline check-in by script.
So you could write your own script, whcih checks all #includes for
validity.

As I wrote, it is obscure, but it should work and this script shouldn't
be as complicated.

 
Reply With Quote
 
Ron Natalie
Guest
Posts: n/a
 
      11-29-2006
Stephan Kuhagen wrote:
> Hello
>
> Please forgive me, if this is the wrong NG, since this is a compiler
> specific C++-Question:


How the stuff between the "" or <> is mapped to files is entirely
implementation specific.

While windows is lenient with case issues, UNIX typically is not.
Best to get the case right.
 
Reply With Quote
 
Stephan Kuhagen
Guest
Posts: n/a
 
      11-29-2006
Ondra Holub wrote:

> I would have one (obscure) solution. I do not know, which versioning
> system are you using. Some of versioning systems allow run some script
> during checking-in new version of source. Such script may perform some
> checks or modifications of file being checked-in (adding change log,
> etc.). I think in ClearCase is possible to decline check-in by script.
> So you could write your own script, whcih checks all #includes for
> validity.
>
> As I wrote, it is obscure, but it should work and this script shouldn't
> be as complicated.


Hehe, thanks, but I already did that. I wrote a Python-package that is able
to check several rules from our programming style guide. But this only
produces one more place with an ignored error message in the build system.
The only really good solution would be to make the code uncompilable on
Windows and let the compiler throw an error... If they can't use their own
code on their Windows-Machine they must fix it...

Stepgan
 
Reply With Quote
 
Victor Bazarov
Guest
Posts: n/a
 
      11-29-2006
Stephan Kuhagen wrote:
> Ondra Holub wrote:
>
>> Hi. I was dealing with the same problem too. But it is not problem of
>> compiler, it is problem of filesystem, because on FAT or NTFS are
>> always files, which differ only in upper/lower case letters, treated
>> as same files. You can try it with gcc on Windows, there is the same
>> problem.

>
> Yes, I know. But since Windows is able to show the filenames in
> correct case in the Explorer or even with dir in the console, I
> thought (desperately hoped...) there may be a switch in the MS
> compilers or an obscure pragma to make them check the spelling...


You might want to ask in 'microsoft.public.vc.language'... Next time
please post all compiler-specific questions (and answers) to the right
newsgroup.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


 
Reply With Quote
 
rossum
Guest
Posts: n/a
 
      11-29-2006
On Wed, 29 Nov 2006 14:54:03 +0100, Stephan Kuhagen
<(E-Mail Removed)> wrote:

>Hehe, thanks, but I already did that. I wrote a Python-package that is able
>to check several rules from our programming style guide. But this only
>produces one more place with an ignored error message in the build system.

If code cannot compile without any errors or warnings, then it should
not be released. Maybe a change to your local standards is needed?

>The only really good solution would be to make the code uncompilable on
>Windows and let the compiler throw an error... If they can't use their own
>code on their Windows-Machine they must fix it...

Can your Python package alter the text of the source files as they are
scanned? If so just add "-Incorrect Case" to all invalid filenames so
they won't compile:

#include <FiLeNaMe.AbC>

would become

#include <FiLeNaMe.AbC-Incorrect Case>

which will cause a "File not found" error at the very least

rossum

 
Reply With Quote
 
Stephan Kuhagen
Guest
Posts: n/a
 
      11-30-2006
rossum wrote:

> If code cannot compile without any errors or warnings, then it should
> not be released. Maybe a change to your local standards is needed?


The standards are this way, its the (Windows-)programmers brains that are
not that way...

If the code has compiler errors, it is not released of course. Getting rid
of all warnings is impossible, if you have several millions lines of code
which must compile on 3 platforms with 7 different compilers (WinXP/2k VC6,
VC7, VC8, Linux GCC 4.0/4.1, MacOSX gcc 4.0 on PPC and i86)...

What I want to achieve, is to get the code faster into a good state, and
since there is code to be released and code to be used only internal which
can be released sometime in the future, when it is stable and good enough,
this would make more code faster releasable.

> #include <FiLeNaMe.AbC>
>
> would become
>
> #include <FiLeNaMe.AbC-Incorrect Case>
>
> which will cause a "File not found" error at the very least


Yes, I tried this, but it has the disadvantage, that this is only a 20%
solution: The Python code must not only look for the exact file in the same
directory, but everywhere, where a compiler might search for includes
(which would be really hard to do, because of include paths and such).

I thought much about the problem, and the only solution seems to me, to make
the Microsoft compilers fail on those include-statements.

Regards
Stephan


 
Reply With Quote
 
Stephan Kuhagen
Guest
Posts: n/a
 
      11-30-2006
Victor Bazarov wrote:

> You might want to ask in 'microsoft.public.vc.language'... Next time
> please post all compiler-specific questions (and answers) to the right
> newsgroup.


Thanks for the advice, I did not know these groups and had no Idea, where to
ask. - So I posted in microsoft.public.vc.language and related now, but did
not get an answer. Maybe the problem has no solution. - Although I can not
really accept that...

Thanks anyway
Stephan

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
check file exists with case sensitive on a case insensitive filesystem Xah Lee Perl Misc 4 04-05-2009 11:21 PM
string.indexof case insensitive Guoqi Zheng ASP .Net 4 01-25-2009 02:07 AM
case insensitive find on case sensitive stl map benhoefer@gmail.com C++ 1 04-06-2007 08:42 PM
how to case select with case-insensitive string ? Tee ASP .Net 3 06-23-2004 07:40 PM
searching lines case-insensitive James Hunt Perl 4 06-05-2004 06:13 PM



Advertisments