Message from C, C++ discussions

December 2019

— In C++ you cannot

— 

#define NEW(T) (T*)malloc(sizeof(T))
#define MANY(T,N) (T*)malloc(sizeof(T)*(N))

...
int* a = NEW(int);
int* b = MANY(int,10);

— Int* i = malloc(sizeof(char)*10);
Terrible bug

— And how (int*) fixes it, lol?

— Yeah
Better not to write in C

— Int* i = (char*)malloc(sizeof(char)*10);
Compile error

— Is C code

— Int* z = MANY(double, 10);
Compiler error

— Or just use C++ or Rust

— I know and it's ugly

— I like C and use C

— ANSI c it's only c