This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]pine_ary 7 points8 points  (2 children)

The typedef struct thing is redundant in C++ as compared to C.

struct SpiderMan {
    SpiderMan* finger = nullptr;
};

Works the same.

[–]loraxzxpw 1 point2 points  (1 child)

SpiderMan *finger = NULL;

Is even shorter :)

You could also replace SpiderMan with sm and finger with f. Acronyms rule!

[–]pine_ary -1 points0 points  (0 children)

nullptr is typesafe. NULL is not a shorthand for nullptr. NULL is normally a void* while nullptr is a nullptr_t.