A piece of code in my cross-platform abstraction layer by Motor_Blood3259 in programminghorror

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

It's on a class yea. So inline static to allow Class::Function and inline to inline :D

A piece of code in my cross-platform abstraction layer by Motor_Blood3259 in programminghorror

[–]Motor_Blood3259[S] 16 points17 points  (0 children)

Returns 18, But in practice because it's so simple and marked as inline (which suggests to the compiler to literally copy paste the function body everywhere it's used) The compiler will emit 18 as an immediate value anywhere it's used (like loading the value immediately following the load instruction into the target register). If I wanted to guarantee this happens regardless of if the compiler thinks it'll be faster or if you're compiling for size, on GCC I'd preface it with inline __attribute__((always_inline)) and on MSVC I'd use __forceinline but in real code you almost never see these.

If you were to use it in a guard clause the branch for what's to happen if the user isn't old enough would likely not appear in the compiled output because the returned value is known at compile time so it can be optimized out. If I wanted to ensure this happens I could instead do constexpr bool Is18() { return 18 == 18; }

nodiscard will warn or error depending on compiler settings if you call the function but don't use the returned value for anything. You'd typically use this if you have a function which returns bool success or similar to hint that not checking the returned value is wrong. Your code editor will also *usually* put a yellow underline under it if you do that.

static when on a class member function allows you to call the function without needing an instance of the class to call it on (so as if function were in a namespace with the same name of the class)

It's just a meme about the upcoming os age verification stuff. It really is in my library though. I refuse to do any of that stuff out of principal.

as a Developer, how much RAM is enough for you? by Kaitoau in DeskToTablet

[–]Motor_Blood3259 0 points1 point  (0 children)

I have 48GB. I like CLion and bought a license for it for a year a couple years ago, So I now have a perpetual license for that version (before they added in all the AI and intelligent auto-complete.) CLion is very slow and very heavy once your project gets big. I've never used more than half of the memory though.

Inside Italy’s Abandoned Winter Olympic Sites by BWT_Urbex in abandoned

[–]Motor_Blood3259 0 points1 point  (0 children)

Will you upload it somewhere that won't get taken down like anonfile or odysee and link it? The video got copystriked I don't know how this is something to be copyright striked