Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@lucas22 I'm not trying to debug it. I'm trying to figure out why this works.
-
@perix2 if I use int, I'll get a single output which will be 20 due to float to int implicit conversion. But I'm getting some garbage values each time I try to execute it.
-
@prabhakaran9397 that's probably because you're not actually declaring x and y, so what the compiler does is get random recent values that sometimes happen to be the correct ones. If there's one thing I've learned with C is that GCC warnings sucks and common errors are inexistent. I always use g++ or some other like clang.
-
Where did you learn that? Not declaring the type of the parameters predates the ANSI standard. That's really archaic, nobody declares their parameters like that any more, not for a long time. Last time I saw code like that it was from the 80s. I'm kind of surprised the compiler didn't warn about it.
-
osmarks8678yDon't use undefined behaviour. If it happens, the compiler would not be violating the standard if it wiped your hard drive when you ran it.
-
Default int as said by @QoolQuy2000. the compiler feeds data laid out like a float in memory to a function that treats the same memory as an int.
Even if you don't use the stdlib, C++ keeps you safer by default.
And no matter which, always -Wall -
@Tychus trying to learn how GCC was designed and how it differs from G++ in parser phase
Related Rants
Day by day I realise that I don't know C
undefined
godlevel
c