Limit to a "char *a=new char[sizeMax]"

I notice that when I use the code:
1
2
3
int size = 276447234; // or bigger
char *a=new char[size];
SendCommand(line, a, size); // fct that writes a given output in "a" 

there is a size limit of 276447233 attributed to my int size.

(e.g. When I enter int size = 276447239 and display the size after have used my pointer the way I wanted, I notice its size has been decreased to this 276447233...)

Would anybody know why?
Thank you

Sky
Probably UB. Post a full compilable example that has the problem you're describing.
What does UB mean?
I'm working on a c++ pipe program communicating with a thermodynamical software, so it won't compile if you don't have the software, but I'll see if I can get an easy example out of this.
Thanks though

Sky
UB means undefined behavior. Basically, you have an error somewhere.
Last edited on
It is interesting to see how did you determine that the size iwas truncated?
Topic archived. No new replies allowed.