Deutsch   English   Français   Italiano  
<8734neak5d.fsf@nosuchdomain.example.com>

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

Path: ...!feeds.phibee-telecom.net!2.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: how cast works?
Date: Thu, 08 Aug 2024 12:29:02 -0700
Organization: None to speak of
Lines: 23
Message-ID: <8734neak5d.fsf@nosuchdomain.example.com>
References: <v8vlo9$2oc1v$1@dont-email.me> <slrnvb7kis.28a.dan@djph.net>
	<v929ah$3u7l7$1@dont-email.me> <v92gt1$e1l$1@dont-email.me>
	<20240808193203.00006287@yahoo.com> <v92va5$4msg$1@dont-email.me>
	<v930ga$4mni$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Thu, 08 Aug 2024 21:29:03 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="e4aa1d660b902ae3f8bff1af6f96edaf";
	logging-data="216371"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18RCrscd8T2P3ALF8n4Anlr"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:3/wSD05iGpemX+X9xgV4e9Gan98=
	sha1:KJ8YK/z+eCDYs5z1lkJhE/CI2uk=
Bytes: 1802

Thiago Adams <thiago.adams@gmail.com> writes:
[...]
> For constexpr the compiler does not accept initialization invalid types.
> for instance.
>
>  constexpr char s = 12345;
>
> <source>:6:21: error: constexpr initializer evaluates to 12345 which
> is not exactly representable in type 'const char'
>     6 |  constexpr char s = 12345;

The problem there is the value, not the type.  This:

    constexpr char s = 10;

is perfectly valid.  The initializer is of type int, not char, but it's
implicitly converted.

[...]

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */