Apostrophic Integers

Started by Robert, October 01, 2023, 02:06:37 AM

Previous topic - Next topic

MrBcx

I happened upon Robert's post and my smart-ass response from a year ago and decided this thread deserved an update. 

As Robert pointed out, when compiling with Pelles C using compiler flag /std:C2X, we can use apostrophic integers. 
We don't need any special flags, if using MINGW or MSVC - it just works.  Lcc-Win32 users, sorry - out of luck.


In our BCX code, we accomplish this by employing the ! operator, as in line two below:

DIM i AS INT
!  i = -123'456'789; // don't forget the semi-colon
PRINT i
PAUSE

Output:

-123456789



MrBcx


The same committee designs tree swings.

Robert

Apostrophic integers, for example 123'456'789, can be used in C++ since C++14. C will have them in next standard. Available now in Pelles C using compiler flag /std:C2X.


#include <stdio.h>

static int     int1;

int main(int argc, char *argv[])
{
  int1=123'456'789 + 1;
  printf("% d\n",(int)int1);
  return 1;
  }