Path: csiph.com!news.swapon.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: strong types in c - (safety samples)
Date: Fri, 16 Feb 2024 08:23:35 -0800
Organization: A noiseless patient Spider
Lines: 53
Message-ID: <86bk8gz8c8.fsf@linuxsc.com>
References: <867cja47qp.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="acda77ef139adc7a575507d0f435d89d"; logging-data="4131441"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+1oyHTHOUhEsN8dPwI953XGHw/Zc7uBi0="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:kPee3UgWvfx1YNvH/wYaA4ZM7UM= sha1:7lkNOPnJKBgbww3hQHy0CdL4EGs=
Xref: csiph.com comp.lang.c:382580
Thiago Adams writes:
> Em 2/12/2024 1:38 AM, Tim Rentsch escreveu:
>
>> Thiago Adams writes:
>>
>>> Consider:
>>>
>>> void f(int i);
>>>
>>> enum E {A};
>>>
>>> int main(){
>>> f(A); //cake will have a warning here
>>> }
>>>
>>>
>>> I will create a diagnostic in cake for this and others.
>>> Basically I will respect the standard where it says enumerators are
>>> int, but I will create a strict mode where this and other types of
>>> conversion happens.
>>>
>>>
>>> int main(){
>>> f(true); //cake will have a warning here
>>> f('A'); //not sure this one..
>>> }
>>>
>>> the same for enums.
>>
>> This is comp.lang.c. Please take any discussions of languages
>> other than C to a venue where those discussions are topical,
>> such as comp.lang.misc.
>
> Not sure what you mean.
> This is about C and diagnostics.
>
> For instance:
>
> void f(int i);
> int main()
> {
> f(true);
> }
>
> If a compiler emit a diagnostic "warning passing _Bool to integer" do
> you think this is not C any more?
The language you're talking about may have the same syntax
as C, but it has different semantic rules, and that is the
point of your discussion. What you're talking about is not
about C. I know you like to pretend that it's the same,
but it isn't.