MMBasic for Windows - alphas


Author Message
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4276
Posted: 09:36pm 22 Feb 2022      

  matherp said  
  Quote  With GCC you can tell the compiler whether unqualified chars should be treated as unsigned or signed,


It has been a complete nightmare under C++ on VS2022

With your default every strlen, strcpy etc. would give a hard error because they only accept (char*)

I use typedef to get

uchar  (an unsigned char) - usually just an 8-bit item, often not a character

schar  (a signed char) - hardly ever used

char  (don't care) - commonly actually is a character

Seems to survive porting well.

OTOH I don't tend to be porting existing code written by someone else.

I wonder if you could use C++ overloading to make strlen(unsigned char *) the same as strlen(char *).

John