Skip to content
Better HN
Top
Best
Ask
Show
New
Jobs
Search
⌘K
0 points
gjulianm
13y ago
0 comments
Save
Share
I didn't know that. To answer my previous question, clang doesn't fire a warning when passing pointers of any size to the function foo.
And by the way, nice talk, it's great learning these dark secrets of C.
0 comments
4 comments · 2 top-level
top
newest
oldest
rjek
13y ago
· 2 in thread
The compiler can't know at compile time with a naked pointer like it can with an array. [static 1] is handy to say it must not explicitly be NULL, as if it were optional, however.
gjulianm
OP
13y ago
Yes, but I expected some kind of "You're passing a pointer as an array of size n. I can't check the size, but you should make sure you've checked it".
ori_b
13y ago
I can't imagine that would be anything but noise. 99% of my function calls have pointers passed through, not arrays.
adsr
13y ago
But a pointer is not the same thing as an array, a pointer does not carry the size of the allocated space which an array does in the same scope.
j
/
k
navigate · click thread line to collapse