Deutsch   English   Français   Italiano  
<vsrilf$2jlgk$2@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!eternal-september.org!.POSTED!not-for-mail
From: David Brown <david.brown@hesbynett.no>
Newsgroups: comp.lang.c
Subject: Re: "A diagram of C23 basic types"
Date: Sat, 5 Apr 2025 17:36:15 +0200
Organization: A noiseless patient Spider
Lines: 47
Message-ID: <vsrilf$2jlgk$2@dont-email.me>
References: <87y0wjaysg.fsf@gmail.com> <vsj1m8$1f8h2$1@dont-email.me>
 <vsj2l9$1j0as$1@dont-email.me> <vsjgk0$207gb$1@paganini.bofh.team>
 <vsjkc8$252sk$1@dont-email.me> <vspvqk$sl3u$1@dont-email.me>
 <85semnica1.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 05 Apr 2025 17:36:15 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="f18e61aba241dcc58e6a1ecca4ee4272";
	logging-data="2741780"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/Nc/nv+/IiY/nNYOVvu7d6pm+6iQTAiAc="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:+I3RsyN9TiniTiD5wWNeOyLKmOo=
Content-Language: en-GB
In-Reply-To: <85semnica1.fsf@nosuchdomain.example.com>
Bytes: 2955

On 05/04/2025 04:15, Keith Thompson wrote:
> James Kuyper <jameskuyper@alumni.caltech.edu> writes:
>> Muttley@dastardlyhq.org wrote:
>>> On Wed, 2 Apr 2025 14:12:18 -0000 (UTC)
>>> antispam@fricas.org (Waldek Hebisch) wibbled:
>> ...
>>>> C99 has VMT (variable modified types).  Thanks to VMT and complex types
>>>> C99 can naturaly do numeric computing that previously was done using
>>>> Fortran 77.  Offical C++ has no VMT.  C++ mechanizms look nicer,
>>>
>>> Officially no, but I've never come across a C++ compiler that didn't support
>>> them given they're all C compilers too.
>>
>> There exist many programs that can compile either C code and C++ code,
>> depending either upon the extension of the file name or explicit command
>> line options to determine which language's rules to apply. That doesn't
>> qualify. Do you know of any compiler that accepts VMTs when compiling
>> according to C++ rules? If so, please provide an example. It will help
>> if the code has some features that are well-formed code in C++, but
>> syntax errors in C, to make it clear that C++'s rules are being implemented.
> 
> g++ and clang++ both do so:
> 
> int main() {
>      class foo { };
>      int len = 42;
>      int vla[len];
> }
> 
> Both warn about the variable length array when invoked with "-pedantic"
> and reject it with "-pedantic-errors".
> 

There are also things that are VLA's in C, but ordinary arrays in C++, 
and acceptable in both languages :

int main() {
	const int len = 42;
	int arr[len];
}


> Microsoft's C and C++ compilers do not support VLAs.  (Their C compiler
> never supported C99, and VLAs were made optional in C11, so that's not a
> coformance issue.)
>