scy @scy@chaos.social · activity timestamp 2 hr. ago Snarky, but a good point.#CPP #CPlusPlus Read more Read less Translate Translate alt Screenshot from a C++ tutorial: Warning Although you generally should not declare multiple variables on a single line, if you do, the asterisk has to be included with each variable. int* ptr1, ptr2; // incorrect: ptr1 is a pointer to an int, but ptr2 is just a plain int! int* ptr3, * ptr4; // correct: ptr3 and ptr4 are both pointers to an int Although this is sometimes used as an argument to not place the asterisk with the type name (instead placing it next to the variable name), it’s a better argument for avoiding defining multiple variables in the same statement. Screenshot from a C++ tutorial: Warning Although you generally should not declare multiple variables on a single line, if you do, the asterisk has to be included with each variable. int* ptr1, ptr2; // incorrect: ptr1 is a pointer to an int, but ptr2 is just a plain int! int* ptr3, * ptr4; // correct: ptr3 and ptr4 are both pointers to an int Although this is sometimes used as an argument to not place the asterisk with the type name (instead placing it next to the variable name), it’s a better argument for avoiding defining multiple variables in the same statement. #cplusplus #cpp Reply Boost Quote Like More actions Copy link Share View remotely Get latest replies Flag this post Block
alt Screenshot from a C++ tutorial: Warning Although you generally should not declare multiple variables on a single line, if you do, the asterisk has to be included with each variable. int* ptr1, ptr2; // incorrect: ptr1 is a pointer to an int, but ptr2 is just a plain int! int* ptr3, * ptr4; // correct: ptr3 and ptr4 are both pointers to an int Although this is sometimes used as an argument to not place the asterisk with the type name (instead placing it next to the variable name), it’s a better argument for avoiding defining multiple variables in the same statement. Screenshot from a C++ tutorial: Warning Although you generally should not declare multiple variables on a single line, if you do, the asterisk has to be included with each variable. int* ptr1, ptr2; // incorrect: ptr1 is a pointer to an int, but ptr2 is just a plain int! int* ptr3, * ptr4; // correct: ptr3 and ptr4 are both pointers to an int Although this is sometimes used as an argument to not place the asterisk with the type name (instead placing it next to the variable name), it’s a better argument for avoiding defining multiple variables in the same statement.
Markus Gerstel @markus@mast.uxp.de · activity timestamp 1 hr. ago @scy So close. It's an argument to avoid that language 😉 Read more Read less Translate Translate Reply Boost Quote Like More actions Copy link Share Flag this comment Block
Sean Murthy @smurthys@hachyderm.io · activity timestamp 43 min. ago @markus @scy Baby, bathwater. Although I agree there's quite a bit of bathwater in the language. (OK, OK. It's mostly bathwater.) Read more Read less Translate Translate Reply Boost Quote Like More actions Copy link Share Flag this comment Block
Markus Gerstel @markus@mast.uxp.de · activity timestamp 32 min. ago @smurthys @scy All I see is a sea of templates for bathwater and a Baby type pointer. Read more Read less Translate Translate Reply Boost Quote Like More actions Copy link Share Flag this comment Block
scy @scy@chaos.social · activity timestamp 27 min. ago @markus @smurthys I'm asking both of you, exactly once, to continue this discussion in a more appropriate place, like 4chan or Hacker News, I really don't give a damn which languages you think you need to ridicule (poorly, fwiw)https://chaos.social/@scy/117710543369565569 Read more Read less Translate Translate Reply Boost Quote Like More actions Copy link Share Flag this comment Block
@scy So close. It's an argument to avoid that language 😉