Better HN
topnewbestaskshowjobs
Log inSign up

chelahmy

5 karma · joined Dec 2, 2016 (9y ago) · 5 submissions

Submissions

comment 9y ago · link · parent

Will the following help with the depth, or any depth?

  int *a, **b, **c, **d;

  d = c = b = &a;

comment 9y ago · link · parent

I read it as integer arithmetic. It is semantically different from pointer arithmetic.

comment 9y ago · link · parent

Even if it is done correctly with a comma after the 'bar' instead of a semicolon, I think it is a bad practice to separate statements with commas. But if you think in semicolon all of the time and skip some brackets then you will mostly get similar buggy code as the above.

comment 9y ago · link · parent

> some other structure hanging onto the original reference.

Let's unleash the superpower of C. You should've been using pointers to a pointer so that it is always a single reference to a memory block.

You can't really be programming in C if you're not thinking in pointers.

One more thing; The article should have mentioned "pointer increment" which has nothing to do with "+= 1".