Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.lang.c > #395853

Re: type of decimal constants in msvc

From Thiago Adams <thiago.adams@gmail.com>
Newsgroups comp.lang.c
Subject Re: type of decimal constants in msvc
Date 2025-12-19 08:43 -0300
Organization A noiseless patient Spider
Message-ID <10i3dpt$14ajr$1@dont-email.me> (permalink)
References <1097ivh$ntii$1@dont-email.me>

Show all headers | View raw


Em 02/09/2025 17:10, Thiago Adams escreveu:
> The type used by MSVC compiler seems not follow the C standard.
> 
> I choose the number 2147483648 that is the next number after max signed 
> i32.
> 

For some reason GCC and clang have a warning (integer literal is too 
large to be represented in a signed integer type) only for decimal form.

We have a warning for 18408377700990114895  but not for the same number 
written as hex 0xff77b1fcbebcdc4f.


int main(){
    static_assert(18408377700990114895 == 0xff77b1fcbebcdc4f);
}

https://godbolt.org/z/PPYErfrTP

But I don't think hex is especial in this case.

unsigned long long u[] = {18408377700990114895 , 0xff77b1fcbebcdc4f};

I think a suffix ULL maybe useful in this case.

Back to comp.lang.c | Previous | NextNext in thread | Find similar


Thread

Re: type of decimal constants in msvc Thiago Adams <thiago.adams@gmail.com> - 2025-12-19 08:43 -0300
  Re: type of decimal constants in msvc Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-19 04:15 -0800
    Re: type of decimal constants in msvc Thiago Adams <thiago.adams@gmail.com> - 2025-12-19 09:49 -0300
      Re: type of decimal constants in msvc Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-19 12:26 -0800
        Re: type of decimal constants in msvc Tim Rentsch <tr.17687@z991.linuxsc.com> - 2025-12-22 05:05 -0800
          Re: type of decimal constants in msvc Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-22 12:01 -0800

csiph-web