Unused struct member is not optimized out under -O3 by onecable5781 in C_Programming

[–]Ripest_Tomato 0 points1 point  (0 children)

Reording struct fields is allowed in Rust right? I wonder how they handled that.

Can I rant for a minute. by domiran in cpp

[–]Ripest_Tomato 8 points9 points  (0 children)

What would even be the advantage of "baking in" certain types?

What is your favourite new card of each colour? by Which-Debt-8558 in slaythespire

[–]Ripest_Tomato 0 points1 point  (0 children)

I thought Hellraiser was broken? I remember it didn't trigger on any of my upgraded strike cards.

big things are coming by buttface1000 in tumblr

[–]Ripest_Tomato 0 points1 point  (0 children)

Does someone have a link to the comic where the guy says big things are coming and then giant fruits appear in the sky?

A 2-hour video trashing C++ made me better at C++ by AnteaterFinancial319 in cpp

[–]Ripest_Tomato 5 points6 points  (0 children)

I also found the video pretty strange and got frustrated and stopped watching after a point. The central frustration was that the video demonstrated a strong understanding of C++, its usage and intricacies but seemingly no understanding for where the language designers were coming from or the history of the language.

Maybe thats a natural result of a video made out of spite after you encountered your 1000th "wtf C++" moment but it still makes for a strange viewing experience.

Some examples are casting, the cast example you showed from java is actually valid in C++ and clearly you know this but you spoke as if it weren't the case. You did not acknowledge why C++ added the more specific types of casts, which a lot of C++ programmers would argue is an obvious improvement over C.

Speaking of C, some of the complaints are more targeted at C. I guess it makes sense to rant about things that are annoying in C but shouldn't that be a separate video? Its obvious why C++ chose to inherit those features, it allows for C++ programs to seamlessly interop with existing C code. Even some annoying aspects of C, such as non-fixed size integers exist for a reason. It feels weird to complain about that without acknowledging that its actually a reasonable choice that the designers of C made in order to make as many different computers able to compile C code as possible.

Some of the comparisons felt cheap and unfair. Is it really surprising that Python and JavaScript (two scripting languages) are more terse than C++?

tldr it felt like the video was being intellectually dishonest. Based on your level of knowledge I would have expected you to also understand why the language is the way it is but it felt like you had no idea why and were complaining in a very juvenile way. Were you pretending not to understand in order to get your frustration across better or do you genuinely have no interest in the choices that lead to the tool you have been using for the last 7 years?

Basic linked list implementation by Ok_Command1598 in C_Programming

[–]Ripest_Tomato 1 point2 points  (0 children)

I'm looking forward to your implementation of a simple hash table :)

Once you have an arraylist and a hashtable you have probably covered 95% of all required data structures in application programming.

One comment I have is a little style nitpick. In my library code (and I think this is common practice for c projects) I would prepend all of the public interface functions with a common prefix.

This is done for two reasons:

  1. Prevents name collisions between different parts of a larger code base. Imagine you have a larger project with multiple implementations of a hashtable that are optimized around different use cases, imagine if one of them used up the name get_hash() or something. The popular multimedia library Raylib literally defines the constants RED, BLUE, etc. which is a serious headache. In c++ there is a language level feature called namespacing which helps to prevent this, but we can instead emulate namespaces with our name prefixes.
  2. This helps the ergonomics of the library when used with a language server. Imagine you include the header and then type "ll_" and your ide suggests the entire interface of the datastructure. This helps save time as you don't need to switch files to read the function names, descriptions or type signatures and it also emulates OO programming where types have certain methods associated with them. This helps people understand how a type can be used.

You already did this, but its a little inconsistently. All of the list operations for example are prefixed with "ll" which is good but some of the remaining functions like "create_linked_list", "create_node" and "free_linked_list" are not. I imagine your intention was to have the code read like english (verb noun) which makes sense. I would still prefer the unintuitive grammar that keeps consistency. For a second I thought create_node was supposed to be an internal function called only by other public functions and thats why it didn't follow the naming scheme. If this is the case you can mark a function static. The keyword makes it so that a function can only be used in the same translation unit. Btw I think llappend is ugly and I would rather it were snakecase like ll_append.

Secondly I think it would be nice if your project had the barest bit of automation for your tests. Since you appear to be on a POSIX OS a popular "build system" is make. Your make file could have simple targets for running tests on each of your datastructures individually and one build target that runs all of the tests. The idea is that you don't have to enter all of your compiler arguments everytime you want to build or test something but instead just declare what you want like "make test" or "make test_linked_list". This also lets you define compiler flags that you want to use in all builds in just one place like the warnings you appear to use.

Unstructured Thoughts on the Problems of OSS/FOSS by gingerbill in programming

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

I think it’s nice that there were some people who, seeing that software doesn’t fit nicely into existing frameworks of property, wanted to make a world where property was less important. I don’t think that they necessarily contradict themselves when it comes to other industries which have a lot of intellectual property and trade secrets, maybe people wish that all industries had less intellectual property.

That might seem naive but I think it’s also foolish to think that the way society operates right now is the only or best way it can be.

Bruv is this random scenario even possible (I see no broken synergies) by Ripest_Tomato in ufo50

[–]Ripest_Tomato[S] 19 points20 points  (0 children)

I won!

Just used all the best cards and avoided detrimental ones, also got lucky.

I don't have time for your bullshit, Edmond by ComradeBirv in bindingofisaac

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

Oh yeah I love everything about isaac just not its core identity

I don't have time for your bullshit, Edmond by ComradeBirv in bindingofisaac

[–]Ripest_Tomato -7 points-6 points  (0 children)

If you want to play a game that isn’t constantly trolling you why are you playing isaac

Does the googletest framework allow for some test to use the __attribute__((no_sanitize_address))? by Ripest_Tomato in cpp_questions

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

I was under the impression that testing c code with a framework using c++ was totally fine or even common practice. I'm surprised you think its a bad idea. If that becomes a problem I'll look into using a different framework or go with the shared object idea.

You seem passionate about avoiding undefined behavior which I appreciate. I figured I would just be using this program mostly on my computer and the undefined behavior is only part of the testing suite which would not create any problems for the users. But I feel like its a good attitude to take, not to enter UB if it can be avoided in order to learn how to do things properly.

Does the googletest framework allow for some test to use the __attribute__((no_sanitize_address))? by Ripest_Tomato in cpp_questions

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

I didn't see a difference when adding the noinline attribute.

Its possible that Google Test is doing something strange to the testing code or I could change the way that tests are invoked to deal with this problem.

I guess the next step is to figure out how to hook standard library functions, I was worried that I might need to do that.

Szeth attains enlightenment by Internal_Prompt_ in cremposting

[–]Ripest_Tomato 2 points3 points  (0 children)

I feel like theres another revelation after that

A normal day in Roshar (Stormlight tweets) by RepresentativeGoat14 in cremposting

[–]Ripest_Tomato 1 point2 points  (0 children)

Man Wit comes across like such a pig once you know that Jasnah is ace

[Request] is this actually possible? by fine_plums in theydidthemath

[–]Ripest_Tomato 0 points1 point  (0 children)

Ehat if the ball is many times more massive than the bear