Deutsch   English   Français   Italiano  
<v31h79$3uud9$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: David Brown <david.brown@hesbynett.no>
Newsgroups: comp.lang.c
Subject: Re: C23 thoughts and opinions
Date: Mon, 27 May 2024 10:45:28 +0200
Organization: A noiseless patient Spider
Lines: 52
Message-ID: <v31h79$3uud9$1@dont-email.me>
References: <v2l828$18v7f$1@dont-email.me>
 <v2o57g$1t5p4$1@raubtier-asyl.eternal-september.org>
 <7d0e8f25-a8ba-4995-9b90-ff35f85d423f@gmail.com>
 <v2p91e$26lpk$1@raubtier-asyl.eternal-september.org>
 <beffc569-3606-b627-ded9-93ce8478f2dd@please.ty>
 <20240525142325.517@kylheku.com> <v2ul1f$3aa7c$1@dont-email.me>
 <871q5o29af.fsf@nosuchdomain.example.com> <v2v7av$3d561$1@dont-email.me>
 <20240526153913.00007f65@yahoo.com> <v2vefo$3e72q$1@dont-email.me>
 <v2vh0f$3eaba$3@dont-email.me> <v2vjc8$3evcm$1@dont-email.me>
 <v2voe0$3fnv7$2@dont-email.me> <v2vqg2$3g7ue$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 27 May 2024 10:45:29 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="7989d793cb4f5bb8f14025e7e8038ebf";
	logging-data="4159913"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/kSg9v+2Gi9pnBE3cdBN4+pNMATwQCLUY="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.11.0
Cancel-Lock: sha1:UPlpxBWGUfTbjfkSoV8YnX9R6Tc=
Content-Language: en-GB
In-Reply-To: <v2vqg2$3g7ue$1@dont-email.me>
Bytes: 3936

On 26/05/2024 19:11, jak wrote:
> David Brown ha scritto:
>> On 26/05/2024 17:10, jak wrote:

>>> ?
>>> I really wrote that something similar (similar != equal) did g++ and
>>> that, if you write c++ code in a file with the .c extension, the g++
>>> compile it. I never wrote that it was automatically recognized.
>>> In addition, you just explained why g++ compile a .c that contains c++
>>> code. I don't understand: no what?
>>>
>>
>> I made an error here - "g++ foo.c" /will/ treat the file as C++.  I 
>> apologise for that, as it made things a lot more confusing.
>>
>> But that is not what you wrote.  Perhaps you didn't write what you 
>> intended to write.  You said that g++ somehow determines whether to 
>> compile code as C or C++ based on the /contents/ of the file, not the 
>> filename suffix.  And that is completely wrong.
>>
>> You also mixed up ".c" and ".C".  gcc considers ".c" to be C code, 
>> while ".C" (with a capital C) is considered C++.
>>
>>
> 
> Sorry but no. I wrote that there are compilers who do it and when they
> replied, bringing the gcc as an example, I replied that the g++ does
> something similar.
> 
> and no, I have not confused the .c with the .C:
> 

You /did/ mix these things up - the Usenet posts are there for you, me, 
or anyone else to read.  But there seems little doubt now that you 
understand the difference between "gcc" and "g++", and between ".c" and 
".C".  So I assume the mixup was a language issue - I fully understand 
that it's not always easy to communicate accurately in a different 
language, and even when you are as good as you are in English, sometimes 
there are miscommunications.

Whichever compiler you use, I strongly recommend using only ".c" for C 
files, and only ".cpp" for C++ files.  There are several other 
extensions used for C++, but IME ".cpp" is the most commonly used and 
supported by all C++ tools on all platforms.  ".C" (capital C) is a poor 
choice - it's hard to distinguish from ".c" (small C), and it will drive 
Windows users crazy.  And if you use gcc, then unless you can stick to a 
pure C++ setup and never use C, I recommend using "gcc" rather than 
"g++" for everything except the final linking stage (and even that is 
optional).  The "gcc" driver program does the right thing.