Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > hi why can not i us #if in the macro?

Reply
Thread Tools

hi why can not i us #if in the macro?

 
 
Emmanuel Delahaye
Guest
Posts: n/a
 
      04-16-2005
Keith Thompson wrote on 15/04/05 :
> Somewhat OT, but most Unix compilers use ".c" for C source and either
> ".C" or ".cpp" for C++ source. (Windows compilers don't use ".C" for
> C++ because the file system can't distinguish between ".C" and ".c".)


Windows XP does, and you must be careful when using Eclipse/CDT,
because .C invokes g++...

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

..sig under repair

 
Reply With Quote
 
 
 
 
Mark McIntyre
Guest
Posts: n/a
 
      04-16-2005
On Fri, 15 Apr 2005 21:31:37 GMT, in comp.lang.c , Keith Thompson
<(E-Mail Removed)> wrote:

>Mark McIntyre <(E-Mail Removed)> writes:
>> On Fri, 15 Apr 2005 06:15:37 GMT, in comp.lang.c ,
>> http://www.velocityreviews.com/forums/(E-Mail Removed) (Richard Bos) wrote:
>>
>>>> Your extension should be .c if you intent to compile a C source.
>>>
>>>Depends on the compiler, surely? With gcc, this is true, but that means
>>>nothing for any other compiler.

>>
>> microsoft copmilers assume its C++ unless its suffix is .c. Some sun
>> compilers differentiate between .C and .c.

>
>Somewhat OT, but most Unix compilers use ".c" for C source and either
>".C" or ".cpp" for C++ source. (Windows compilers don't use ".C" for
>C++ because the file system can't distinguish between ".C" and ".c".)


that should read "couldn't, prior to about 1999". All modern windows
OSen can do this quite handily, though the command interpreter still
is too stupid.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
 
Reply With Quote
 
 
 
 
Mark McIntyre
Guest
Posts: n/a
 
      04-16-2005
On Sat, 16 Apr 2005 08:39:58 +0200, in comp.lang.c , "Emmanuel
Delahaye" <(E-Mail Removed)> wrote:

>Keith Thompson wrote on 15/04/05 :
>> Somewhat OT, but most Unix compilers use ".c" for C source and either
>> ".C" or ".cpp" for C++ source. (Windows compilers don't use ".C" for
>> C++ because the file system can't distinguish between ".C" and ".c".)

>
>Windows XP does, and you must be careful when using Eclipse/CDT,
>because .C invokes g++...


the reason I mentioned this is because we just got bitten on the a*se
by precisely this 'bug'. We ported a library back from Solaris to XP,
and the compile kept falling over mysteriously...


--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      04-17-2005
Mark McIntyre <(E-Mail Removed)> writes:
> On Fri, 15 Apr 2005 21:31:37 GMT, in comp.lang.c , Keith Thompson
> <(E-Mail Removed)> wrote:

[...]
>>Somewhat OT, but most Unix compilers use ".c" for C source and either
>>".C" or ".cpp" for C++ source. (Windows compilers don't use ".C" for
>>C++ because the file system can't distinguish between ".C" and ".c".)

>
> that should read "couldn't, prior to about 1999". All modern windows
> OSen can do this quite handily, though the command interpreter still
> is too stupid.


Still a bit OT ...

Yes, Windows distinguishes between ".c" and ".C", but not in the same
way that Unix does. A file name retains whatever case was specified
when it was created, but you can't have two files in the same
directory named "foo.c" and "foo.C"; if you have a file called
"foo.c", you can successfully open it either as "foo.c" or as "foo.C".

Presumably this means that you can compile a given source file either
as C or as C++ just by changing the name by which you refer to it
(without actually changing the name of the file). (I say "presumably"
because I don't actually use Windows compilers.) Not a huge deal, but
something to watch out for.

To make it topical, all this stuff affects the semantics of fopen(),
which is part of the reason the C standard doesn't say much about what
file names look like other than being strings.

--
Keith Thompson (The_Other_Keith) (E-Mail Removed) <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
 
Reply With Quote
 
Mark McIntyre
Guest
Posts: n/a
 
      04-17-2005
On Sun, 17 Apr 2005 20:34:18 GMT, in comp.lang.c , Keith Thompson
<(E-Mail Removed)> wrote:

>Yes, Windows distinguishes between ".c" and ".C", but not in the same
>way that Unix does. A file name retains whatever case was specified
>when it was created, but you can't have two files in the same
>directory named "foo.c" and "foo.C"; if you have a file called
>"foo.c", you can successfully open it either as "foo.c" or as "foo.C".


FWIW I seem to recall that you can, but creating them via the
high-level functions or command line gui is pretty tricky.

>Presumably this means that you can compile a given source file either
>as C or as C++ just by changing the name by which you refer to it
>(without actually changing the name of the file). (I say "presumably"
>because I don't actually use Windows compilers.) Not a huge deal, but
>something to watch out for.


In fact no - all the compilers I know of are case-insensitive when it
comes to filenames. This hs coincidentally how I know of this issue -
we had some C++ we ported from solaris & linux back to windows, and a
couple of files didn't compile properly with gcc. Turned out they were
named ".C".


--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>
 
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
Why :: ? Why not : ? Why not . ? <- less clutter ?!? Skybuck Flying C++ 16 08-25-2007 09:48 PM
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
why why why does function not work Horace Nunley ASP .Net 1 09-27-2006 09:52 PM
Can someone tell me why I can't delete this file? and why it blue screens WinXP Pro on delete? zZz Computer Support 1 01-12-2005 02:37 AM



Advertisments