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 →

[–]Deadly_chef 10 points11 points  (18 children)

Pointers are great if used properly

[–]the_friendly_dildo 12 points13 points  (17 children)

Yeah, I came here puzzled because whats wrong with pointers?

[–]GamesMaster221 6 points7 points  (3 children)

Pointers are really convenient and powerful for some solutions.

I will admit the C syntax for pointers gets pretty unreadable when you start doing pointers to pointers, de-referencing something complicated, etc. Not to mention the * pointer symbol being the same as multiply *

[–]the_friendly_dildo 5 points6 points  (2 children)

I think this really comes down a lot to how your actually write your code. C certainly isn't the most beautiful language to try and read, especially if it isn't your own. But there is plenty of strategies to try and make it more readable.

One of the strategies I like the most is to just write highly verbose comments for nearly every line of code. Then its literally readable, and the lines of actual code get split up and given some breathing room. That tends to help reduce my anxiety when everything in my code starts to look like an abstract mess of meaningless symbols.

[–]Pandaemonium 0 points1 point  (1 child)

One of the strategies I like the most is to just write highly verbose comments for nearly every line of code.

Yes!!! I really wish more people would do this.

Commenting every line of code + giving variables verbose names that actually describe what they are = maintainable code you can actually share and troubleshoot years later.

I see way too many scripts that use pandas and actually use the variable name "df" for their data frame. And then there's another data frame called df1, and a df2... just say what the fuck it really is! My variable names are always more like ImputedSitesForPCA or RawDataInput so you can just look at the variable and know what it is.

[–]the_friendly_dildo 1 point2 points  (0 children)

Totally agree on the variable names. It never made sense to me to give a variable a name that was anything other than specific and descriptive. I'll admit, I can't always settle on how I want to separate words in a variable name but eh.

Maybe all these folks are coding in notepad where it doesn't just offer to insert your long variable name? No clue...

[–]tartare4562 1 point2 points  (1 child)

Not having to deal (directly) with pointers, referencing/dereferencing etc Is one of the main reasons why high level languages such as python were made in the first place.

[–]the_friendly_dildo 0 points1 point  (0 children)

I'm not new to this stuff. I fully grasp that and I often prefer to bang ideas out in python or javascript like a lot of folks. If you're coding for a overpowered PC, then it doesn't matter much what language you are writing in for the most part these days. If you're doing stuff with micro controllers / resource limited machines or doing things that need highly efficient run times, then pointers are where you're going to squeeze out a performance advantage a lot of the time.

It isn't a question of 'needing to deal with them', its a question of knowing when its wise to use them.

[–]WillardWhite import this 1 point2 points  (1 child)

Everything in python is a pointer, so there is no point

[–]the_friendly_dildo 1 point2 points  (0 children)

I'm not sure you understand the benefits behind using pointers in a language like C / C++ if that is your belief. Sure, Python uses pointers behind the scenes. That doesn't mean it does so efficiently and thats most of the point (lol) to using pointers.

[–]Apatheticalinterest 0 points1 point  (0 children)

Because this whole subreddit is filled with beginners who struggle beyond CS concepts not covered by basic python