Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
natesm
on April 10, 2012
|
parent
|
context
|
favorite
| on:
C Finally Gets A New Standard
That's Objective-C.
int* foo = malloc(sizeof(int));
Is invalid C++.
chimeracoder
on April 10, 2012
[–]
I don't really know C++ as well as I know C - could you explain? I always thought that the only real reason C++ wasn't a superset is because of the additional keywords.
wollw
on April 10, 2012
|
parent
[–]
C++ doesn't coerce the void* malloc returns into an int* , C does. You have to write
int* foo = (int*)malloc(sizeof(int));
in C++ or the compiler gives a type error.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: