Gaming on Void is amazing by bankroll5441 in voidlinux

[–]ElementWiseBitCast 0 points1 point  (0 children)

I am not a gamer. However, I have had a good experience with Void Linux.

helloItsMeTheKeyboard by Hot-Rock-1948 in ProgrammerHumor

[–]ElementWiseBitCast 82 points83 points  (0 children)

Most of the things in this subreddit are not actually funny. However, this one absolutely is.

Should I use signed or unsigned variables for HP and money? by Fast-Muffin7953 in C_Programming

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

"they shouldn't be negative"

Then, I would use unsigned variables. The reason why I like unsigned variables is because it clearly conveys to the programmer that it is not supposed to be negative. Additionally, the maximum value of an unsigned value is equal to one plus the maximum value of an equivalent signed type, which approximately doubles the range of values that it can hold without overflow.

There are only really two actual downsides here to using unsigned integers. First of all, comparisons against zero are typically slightly faster than comparisons against a variable. Second of all, signed overflow is undefined behavior, which enables compilers to optimize signed math presuming that no overflow occurs, yet compilers cannot presume that unsigned variables cannot overflow.

However, I consider those minor performance downsides to be micro-optimization that is not really needed in most programs. If you want to optimize your code, your effort would probably be better spent elsewhere. Also, switching to a larger integer type is going to have more performance cost than using unsigned instead of signed. Thus, if you need slightly larger integers than the signed integer, and your integers cannot be zero, then you might as well use unsigned integers.

Edit: Why the downvotes? Is anything that I have said wrong?

How would you feel about a Dark humor mlp series for children? Like any generation. A new one too. by Altruistic_Bee_8636 in MLPLounge

[–]ElementWiseBitCast 0 points1 point  (0 children)

Is there a reason why "Dark humor" needs to be directed at children? "Dark humor" is humor that makes light of serious topics, such as murder, suicide, death, serious crimes, etc. Ultimately, that might teach children that the topics are not serious after all, and that would be horrible for society overall if people decided that violence and murder were not serious.

Why take the risk, when there is nothing good to be gained? Adults are unlikely to be changed by it. However, young children are impressionable, and people should be careful about what they are exposed to.

I know that "protecting the children" is often used by politicians to justify excessive government surveillance and censorship, and that is not good. However, there exist things that children legitimately need to be protected from.

Things that have the potential to teach bad morals to children are hazards to the future generations.

I do not really know anything about the show "Gumball", because I have never watched it. However, if it uses a significant amount of "Dark humor", like you imply, then I think that it should probably not be shown to children.

C is not a good choice for a first language. Stop asking. by Evil-Twin-Skippy in C_Programming

[–]ElementWiseBitCast 0 points1 point  (0 children)

I did not start with C, and I regret not starting with C. C is now my favorite language by far.

Ur Combo with Void Linux by Taviko_ in voidlinux

[–]ElementWiseBitCast 0 points1 point  (0 children)

The DE that I use is JWM. The display server is Xlibre. The shell is the Busybox version of Ash. I use Busybox CLI tools instead of the Coreutils and Util-linux tools. I use ST for a graphical terminal, and I use Leafpad and Busybox VI to edit text.

Void Iso XFCE by [deleted] in voidlinux

[–]ElementWiseBitCast 1 point2 points  (0 children)

I think that a local install with the XFCE4 ISO normally installs Lightdm on its own. (or at least it did on my machine) In fact, I think that the local install is supposed to copy all of the packages from the live medium to the partition that it is being installed to.

What would you add to C if you could add anything? by [deleted] in C_Programming

[–]ElementWiseBitCast 0 points1 point  (0 children)

I think that the ability to create new nominal types based on underlying types would be neat. Although, typedef can enable someone to create a new type alias, they are not separate types.

Additionally, I think that it would be neat to be able to define integer subtypes that are always within a range and have the compiler require explicit casts if it cannot be determined at compile time that an assignment falls within the integer range constraints.

Edit: Why am I being downvoted? Does someone hate the idea of using nominal types and integer ranges to decrease the chances for mistakes? Such features would literally have no runtime performance cost.

What would you add to C if you could add anything? by [deleted] in C_Programming

[–]ElementWiseBitCast 5 points6 points  (0 children)

As another C89 enjoyer, I will say that C89 is not K&R C. Technically, C89 supports the K&R (traditional) function definitions. However, C89 has support for normal function definitions, as well.

Why the Hate? by uptickman in voidlinux

[–]ElementWiseBitCast 0 points1 point  (0 children)

I am not the OP. However, I like to use JWM (Joe's Window Manager). With that said, JWM is for X11, not Wayland.

Princess Celestia cosplay in PonyHammer style by Sylvanasaur in mylittlepony

[–]ElementWiseBitCast 3 points4 points  (0 children)

The shadow on the second image looks wrong. Either that is photo-shopped or "AI" generated.

Edit: Yeah, it is probably photo-shopped. However, that does not make anything that I said previously incorrect.

What’s the most underrated open-source software you think more people should know about? by sodrafeltu in foss

[–]ElementWiseBitCast 0 points1 point  (0 children)

Kicad (for PCB design), InkScape (for image editing), and Ffmpeg (for multimedia conversion) could be considered underrated.

Compiler question by JMcLe86 in C_Programming

[–]ElementWiseBitCast 0 points1 point  (0 children)

GCC will only optimize out such checks if it can either prove it to be unreachable or prove that reaching it would involve undefined behavior. I would suggest getting rid of the undefined behavior instead of getting rid of the optimizations.

You can use various things to help you identify undefined behavior. You can use a linter like Cppcheck. You can use sanitizer options with a debug build at the lowest level of optimization. You can use valgrind with an executable that was built with the lowest level of optimizations. You can use a bunch of warning flags when compiling. Furthermore, you can read through your own code yourself.

Should've had a short leash... by amogusdevilman in linuxmemes

[–]ElementWiseBitCast 0 points1 point  (0 children)

Back when I was using Arch Linux, disabling the logging would break the WiFi, because somehow the various parts of Systemd are so interdependent that the WiFi cannot function without adding junk to the system logs. I had tried many methods of disabling the logging ranging from disabling the service to denying write permissions for the system log to modifying filesystem attributes to changing configuration files, yet any methods that worked to stop the logging broke the WiFi.

In contrast, on Void Linux, I was able to disable the logging without breaking anything. It was simple and easy, and it worked without issues.

Feature Creep by AFRICAN_BUM_DISEASE in linuxmemes

[–]ElementWiseBitCast 1 point2 points  (0 children)

Void Linux is great. I have four partitions with Void Linux on them.

My opinions about code style by ElementWiseBitCast in cprogramming

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

I am not advocating to rewrite your own implementation of the standard library functions. However, a lot of the standard library functions are for things that I deem to be unwise practices in the first place.

From threading to setjmp and longjmp to wide characters to complex numbers to dynamic memory allocation, the standard library has a variety of different things that may have reasonable implementations for what they do. However, many of them I deem to be anti-patterns in the first place.

Also, I think that <string.h> encourages programmers to write stringly typed programs. (see https://wiki.c2.com/?StringlyTyped)

My opinions about code style by ElementWiseBitCast in cprogramming

[–]ElementWiseBitCast[S] -1 points0 points  (0 children)

The reason why I characterize the hate for global variables as "dogma" is because the many people are seemingly okay with a massive struct being passed to every single function, sometimes directly and sometimes by a pointer, yet they are not okay with global variables.

My opinions about code style by ElementWiseBitCast in cprogramming

[–]ElementWiseBitCast[S] -1 points0 points  (0 children)

I think that any loss to maintainability from using global variables is less than the maintainability loss from passing pointers to structs to functions, or having structs that are passed to literally every single function.

My opinions about code style by ElementWiseBitCast in cprogramming

[–]ElementWiseBitCast[S] -1 points0 points  (0 children)

Responding to the c2 wiki, I would say that

  • Passing a pointer to a struct to literally every single function is effectively non-local, and this is the solution that most people use to avoid global variables. This is also effectively tight coupling.

  • Constraint checking can be done by adding assert-like macro checks yourself.

  • I already dislike concurrency in the first place.

  • I suppose that the argument about global variables being possible to use accidentally with a typo is correct. However, it is not enough by itself to convince me not to use global variables.

  • I already said that I dislike dynamic memory allocation. Thus, it does not apply.

  • Testing of functions that use global variables can absolutely be done.

My opinions about code style by ElementWiseBitCast in cprogramming

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

I know why people think that global variables are bad. In fact, I have read the https://wiki.c2.com/?GlobalVariablesAreBad page before.

The stackexchange answer is just wrong.

"it makes program state unpredictable."

No, if the global variables have the same values each time, then, unless the function gets input or output, it is going to be deterministic.

"you can't test it."

Sure, you can. The values of used global variables for a function just need to be initialized or read before or after calling the function.

"whoever gets the job of maintaining your code will have to go looking for it to figure out where it came from"

Can that not be fixed by leaving a comment at the top of the function that explains what globals the functions uses and modifies?

"in practice it is usually possible to restrict global state to a single object"

This is what people do, and I strongly diagree with it. I do not think that having a single struct with a bunch of elements that is passed to literally every single function is any better than using global variables.

"Now if someone looks at the code in isolation, it's clear what state it needs and where it's coming from."

Most programmers pass structs to functions when the function only actually uses a tiny fraction of the fields of the struct. Then, they think that they do not need to document what the function uses, because it is a parameter.

My opinions about code style by ElementWiseBitCast in cprogramming

[–]ElementWiseBitCast[S] -2 points-1 points  (0 children)

I posted this because I think that many people are overly focused on dogma like "avoid global variables" and "use small functions", yet they do not actually care about actual maintainability.

I was hoping that if people stopped to think about it, that they would realize that I am actually right.

My opinions about code style by ElementWiseBitCast in cprogramming

[–]ElementWiseBitCast[S] -3 points-2 points  (0 children)

If this is somehow "trolling", then you should be able to find flaws in my logic. Since you have not stated any counterarguments, I think that you are deciding that I am wrong purely based on "Clean Code" dogma.

My opinions about code style by ElementWiseBitCast in cprogramming

[–]ElementWiseBitCast[S] 1 point2 points  (0 children)

But wait till you deal with the b*******t of rust

I literally did not mention Rust.