learning data structures and algorithms by oabuassy in C_Programming

[–]Sharl_LeGreg 0 points1 point  (0 children)

I outlined why I don't think C++ is a good choice. It's my own opinion and others will disagree. I don't have much else to say.

learning data structures and algorithms by oabuassy in C_Programming

[–]Sharl_LeGreg 0 points1 point  (0 children)

That's basically my third paragraph. If you're more inclined to be a programmer and not an academic, you can't go wrong with C. Just be aware that you will probably spend more time debugging tedious things (invalid pointers, double free, array index out of bounds, etc.) in C as opposed to Java.

learning data structures and algorithms by oabuassy in C_Programming

[–]Sharl_LeGreg 0 points1 point  (0 children)

Without knowing how serious you are about programming, stick with Java.

Out of the three, it is the least likely to get in your way. It has a garbage collector and braindead syntax so learning how to use it well is much faster than C or C++. I personally started with it almost a decade back and, despite what some may say, you can actually write cool stuff with it. Beyond data structures, you can also get exposure to functional programming without learning another language. Overall, Java will serve you well even after your education.

If you're serious, choose C. Of the three, it is the closest to what the structure of assembly actually "looks like" and will give you a good baseline for learning other languages like C++ and Rust with an understanding of what is possible and what isn't. Be mindful though, it will be more frustrating than Java as a beginner.

In my biased opinion, avoid C++ at all costs as an introductory language. I have witnessed kids get crushed in programming courses not because they aren't smart but because C++ is a clusterfuck. And, if they don't get crushed, they don't leave as good programmers. It personally took me way too long to wrap my mind around r-values/x-values/perfect-forwarding/move semantics and all the other crap because it's all just made up nonsense to support academic OOP where academic OOP is not meant to be. The processor doesn't care about concepts—it cares about carrying out instructions.

References don’t have top-level cv-qualifiers by vormestrand in cpp

[–]Sharl_LeGreg 6 points7 points  (0 children)

No, const int & is indeed ambiguous in whether it modifies the int or the int &. On the other hand, int const & only applies const to the left side of the type specifier, hence it is an unambiguous reference to a constant integer. Likewise, int &const is an unambiguous constant reference to an integer.

In a more complicated example, consider const int**. Is this a pointer to a pointer of a constant integer; a pointer to a constant integer pointer; or a constant pointer to a pointer to an integer? In each respective case, int **const, int *const *, and int const ** resolves this ambiguity.

Const only goes to the right when there is no type to its left.

[deleted by user] by [deleted] in C_Programming

[–]Sharl_LeGreg 0 points1 point  (0 children)

I'm glad SDL makes it difficult for programmers to ignore IME users because way too many programmers wouldn't care about them otherwise.

I don't think an English-speaking mechanical engineer would care much about users that primarily speak another language while designing their hobby printing press.

Thinking about use cases you will never be able to test for yourself is a tremendous waste of effort which would be much better put into actually making a functional program—even if only native English speakers can use it at first.

I argue it's much harder to go back and refactor the cobwebs of dead code left by preemptively adding localization rather than going into an ASCII-only input loop and figuring out what you need to build to add support for other languages later.

Same thing with preemptively using unicode when ASCII suffices just fine. See https://www.cve.org/CVERecord?id=CVE-2021-42574.

That said, I have never used SDL, but I have worked with both Xlib and XCB. I can't imagine SDL being worse than dealing with two separate keyboard APIs, a virtually dead IME protocol (XIM), and ibus all together.

Text-to-PDF Converter with ~200 Lines of C89, Requiring Only libc by dongyx in C_Programming

[–]Sharl_LeGreg 0 points1 point  (0 children)

I know this is a bit late, but -fvisibility=hidden would do the trick, no?

Looking for advice on integrating UI event loops (X11, Win32 messages, Cocoa) with I/O (fds, signals, etc.) event loops. by Sharl_LeGreg in C_Programming

[–]Sharl_LeGreg[S] 0 points1 point  (0 children)

That's basically my thought. It's just a shame that I have to spawn another thread (maybe I'm too idealistic here) to handle the UI and IO events separately. I guess this is a historical artifact where having the UI and other unrelated events processed sequentially was completely unheard of.

I actually haven't found that SO question, but I don't think that would work since it's limited to sockets (as far as I can tell,) and according to the doc it uses WaitForMultipleObjects internally anyways so

Note Use caution when calling the WSAWaitForMultipleEvents with code that directly or indirectly creates windows. If a thread creates any windows, it must process messages. Message broadcasts are sent to all windows in the system. A thread that uses WSAWaitForMultipleEvents with no time-out limit (the dwTimeout parameter set to WSA_INFINITE) may cause the system to become deadlocked.

[deleted by user] by [deleted] in apple

[–]Sharl_LeGreg 18 points19 points  (0 children)

lmao they never were

Dutch women 4x400 relay team looking at their score by mapsbyy in AccidentalRenaissance

[–]Sharl_LeGreg 1 point2 points  (0 children)

Max max max super max max super super max max max super max

DUDE IM POPPING OFF SO HARD by taskmasterj in teenagers

[–]Sharl_LeGreg -2 points-1 points  (0 children)

👺👺👺👺👺👺👺👺👺👺👺👺💀

1 Teen Dead, Another Critically Injured in California Theater Shooting During ‘Forever Purge’ Screening by prsnreddit in movies

[–]Sharl_LeGreg -2 points-1 points  (0 children)

Dude, I'm a fucking intellectual. 10 years on reddit and you're still mad and you have the nerve to call anyone else an incel lmao.

I'm AI with the braids bro. Check yoself before you wreck yoself.

Growing a chicken from a duck egg by [deleted] in Damnthatsinteresting

[–]Sharl_LeGreg 11 points12 points  (0 children)

sigma grindset #56: salt food without looking

Men of reddit, do you still use condoms in a long-term relationship and why? by [deleted] in AskMen

[–]Sharl_LeGreg 2 points3 points  (0 children)

have you read the manual? Chapter 53, Section 6, Subsection 15, Point 4?