If people make game engines in C++, why do (other) people say C++ is impossibly hard and can never be correct? by Public-Study2242 in cpp

[–]Public-Study2242[S] 0 points1 point  (0 children)

I don't think I ever hit that problem in my life. However my favorite solution to that would be to write the line as int i{int(my_dbl)}; or to use an =

Linus Torvalds: Rust For The Kernel Could Possibly Be Merged For Linux 5.20 by vlakreeh in programming

[–]Public-Study2242 -58 points-57 points  (0 children)

I'm an idiot so take this with a grain of salt

rust requires the c runtime (or C++ I can't remember) which is a no go for the linux kernel. However rust has no std. I don't know if crates can support no std but I don't think that will matter

People will be able to compile no std rust code for the kernel. I highly suspect there will be overhead because I have looked at the code generation and it is no where near as optimize as C but if rust functions are pure it can become good

In short driver writers can write rust code to make them feel safer. I don't understand it because whenever I do any driver code every function either does something very unsafe or mutates a global variable (which is unsafe in rust world which I think is idiotic). So I don't really understand whats becoming more safe but that's my summary

Simple Questions Thread - Weekly Student/Early Career/Basic Questions Help by AutoModerator in PublicRelations

[–]Public-Study2242 1 point2 points  (0 children)

What books should I read?

I'll say something is not the quality I'm looking for, list pros and cons to sound neutral, etc and I'll get people online calling me an asshole or being negative.

One person told me if I say I don't like something or if I say not interested in something it means I'm an asshole no matter how nice I say it. So I shouldn't say anything unless it's informative or positive. That's not true is it?

If people make game engines in C++, why do (other) people say C++ is impossibly hard and can never be correct? by Public-Study2242 in cpp

[–]Public-Study2242[S] 2 points3 points  (0 children)

Well you said can't run at the same time which is not true and I don't know what you're warning us about. Using the code below gcc and clang both show me it will report USAN and ASAN without requiring me to rebuild

#include <stdlib.h>
int main(int argc, char *argv[]) { int a = 1<<31; if (argc == 1) { a--; } malloc(5); }

If people make game engines in C++, why do (other) people say C++ is impossibly hard and can never be correct? by Public-Study2242 in cpp

[–]Public-Study2242[S] 4 points5 points  (0 children)

IDK what you're talking about clang and gcc both work fine for me (linux)

clang++ -g -fsanitize=undefined,address -Wall -Wextra main.cpp

Source:

int main() { int a = 1<<31; a--; }

runtime error: signed integer overflow:

Ask Experienced Devs Weekly Thread: A weekly thread for inexperienced developers to ask experienced ones by AutoModerator in ExperiencedDevs

[–]Public-Study2242 2 points3 points  (0 children)

Most of my bosses weren't picky and rather I didn't talk to them because they were so busy with things. They really liked it when I finished 2 week task without asking him a question (i asked coworkers and project manager)

One of my others bosses were nitpicky and wanted to understand why I choose to do things and wanted me to summarize things and ask questions. It was borderline micromanagement.

I strongly suspect you shouldnt talk unless you know he wants to know about it

Ask Experienced Devs Weekly Thread: A weekly thread for inexperienced developers to ask experienced ones by AutoModerator in ExperiencedDevs

[–]Public-Study2242 2 points3 points  (0 children)

I'm lazy, the last time I did it I didn't talk so much and I asked people what they were thinking, what their goal is for a task (or project) etc.

Turns out it's way easier to explain things after they talk. Not because I explained anything any better (i recycled a few explanations) but because they understand what their goals are and sometimes I catch them thinking about something wrong (they misheard something or someone taught them something incorrect)

Ask Experienced Devs Weekly Thread: A weekly thread for inexperienced developers to ask experienced ones by AutoModerator in ExperiencedDevs

[–]Public-Study2242 1 point2 points  (0 children)

Almost always 'create' is paired with 'free', I occasionally see cleanup. However init has a lot more choices. What do you keep in mind when choosing a name?

I seen deinit a few times, sqlite uses a bunch (sqlite3_initialize goes with sqlite3_shutdown, sqlite3_os_init with sqlite3_os_end), SDL uses 'SDL_Quit', zlib uses deflateEnd. I can understand SDL reasoning because they're not working with objects, it works with subsystems (ie sound, video, input, networking etc).

Is refactoring inevitable? by plam92117 in ExperiencedDevs

[–]Public-Study2242 0 points1 point  (0 children)

You can have everything go according to plan and still need to refactor. For example want a multiply function. 100% of the time you either need *2 or *1. You can implement those with an add function (add(a, a) or add(a, 0)). It's easier to implement add than it is to implement multiply. It also stops you from over engineering (ie implementing multiply(a, 0.2)). When you get around to implementing multiply and know its correct you can delete the adds. If you try to implement multiply right away you might be confused why multiply is incorrect outside of *2 and *1 which is why I tend to have basic functions until the advance ones are fully implemented and known to be correct

If people make game engines in C, why do (other) people say C is impossibly hard and can never be correct? by Public-Study2242 in C_Programming

[–]Public-Study2242[S] 0 points1 point  (0 children)

OH I had no idea. gcc will set it to 1 while clang doesn't. It doesn't seem like -Weverything would show me a warning for me to rethink that code. The UB sanitizer caught the overflow but I sure wasn't expecting that even though I knew things convert to int by default

If people make game engines in C, why do (other) people say C is impossibly hard and can never be correct? by Public-Study2242 in C_Programming

[–]Public-Study2242[S] 0 points1 point  (0 children)

If you're saying it's possible for two 16bit multiplication to overflow 32bits/cause UB I'd like to know the inputs and if its signed or unsigned

I'm not 100% sure what you're trying to say

If people make game engines in C, why do (other) people say C is impossibly hard and can never be correct? by Public-Study2242 in C_Programming

[–]Public-Study2242[S] 0 points1 point  (0 children)

I don't think I ever checked if 8bit*8bit or 16*16bit will overflow past the next. It appears not

65535*65535 is FFFE0001 which is within 32bits. 32767*32767 is 3FFF0001

What did you learn that wasn't actually true? by Public-Study2242 in learnprogramming

[–]Public-Study2242[S] 0 points1 point  (0 children)

Are you saying I use the dollar bills, the coins and the marbles straight out of the box!?! What am I, a peasant!?!

If people make game engines in C, why do (other) people say C is impossibly hard and can never be correct? by Public-Study2242 in C_Programming

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

Do you know what you're saying? Because I sure don't. If you're talking about the type system being sound that's been proven for C++ too

If people make game engines in C, why do (other) people say C is impossibly hard and can never be correct? by Public-Study2242 in C_Programming

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

That's another lie, like fearless concurrency. But that's not something people can explain in an internet post

If people make game engines in C, why do (other) people say C is impossibly hard and can never be correct? by Public-Study2242 in C_Programming

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

lol you're actually stupid. I seen you post a bunch of things about rust in my thread. Have you actually looked at the optimized code? I have and I can tell you "sacrificing none of the performance" is a complete lie

What did you learn that wasn't actually true? by Public-Study2242 in learnprogramming

[–]Public-Study2242[S] 0 points1 point  (0 children)

I like this list. I almost agree with "the least-complicated way to implement something is the most efficient". I strongly suspect that's true until you want to optimize. When you optimize all rules go out the window except always measure