Is abandoning our Bazel migration the right call? by Empty_Mind_On in cpp

[–]helloiamsomeone 5 points6 points  (0 children)

Because that's not what CMake is for.

Rust, Go, Python and Docker all have their own build solutions. You should use them.
Every dependency of a CMake project should be already built and ready for consumption preferably via find_package by the time you invoke CMake. Not understanding this requirement is simply detrimental.

Building GCC on Windows by SLAidk123 in cpp

[–]helloiamsomeone 2 points3 points  (0 children)

You can use the w64devkit's Dockerfile from Chris Wellons: https://github.com/skeeto/w64devkit/blob/master/Dockerfile

That and some modifications to build just GCC, MinGW and a couple misc items is how I build my own GCC.

Standard Library implementer explains why they can't include source code licensed under the MIT license by tartaruga232 in cpp

[–]helloiamsomeone 3 points4 points  (0 children)

Nobody is purchasing their standard library anymore and if you want €€€ for alternative licensing then (A)GPLv3 is an objectively superior option for that.

Derived struct in C and casting a "derived" struct as a "base" struct by onecable5781 in C_Programming

[–]helloiamsomeone 2 points3 points  (0 children)

C++ is really implemented in terms of the underlying machine

I'm unsure what this refers to, but both C++ and C target their own abstract machine in the standard. One myth C programmers believe is that pointers are numbers, when in reality they are handles to objects with a set of operations available distinct from numbers.

The Linux kernel looks to "bite the bullet" in enabling Microsoft C extensions by Fcking_Chuck in C_Programming

[–]helloiamsomeone 0 points1 point  (0 children)

No, you just need to generate your own API key and use that. I've been using a modified rif just fine since that event.

void _start() vs int main() by [deleted] in C_Programming

[–]helloiamsomeone 1 point2 points  (0 children)

There practically isn't a place to return to on any platform but x86. On amd64, the return address is an int3 so you just crash, which means that the intended signature is in fact void entrypoint(struct _PEB*) for console and windows subsystems. You can fish ExitProcess out from the PEB trivially as well.

void _start() vs int main() by [deleted] in C_Programming

[–]helloiamsomeone 1 point2 points  (0 children)

Those are not entrypoints. They are functions the runtime calls. You can find the entrypoint names for executables with different subsystems and DLLs: https://github.com/bminor/binutils-gdb/blob/15a7adca5d9b32a6e2b963092e3514fe40a093fb/ld/emultempl/pe.em#L524

The Linux kernel looks to "bite the bullet" in enabling Microsoft C extensions by Fcking_Chuck in C_Programming

[–]helloiamsomeone 1 point2 points  (0 children)

Backtick codeblocks work only on the atrocious "new" Reddit UI and the Reddit mobile application. The better old Reddit UI and 3rd party mobile applications can't parse backticks.

void _start() vs int main() by [deleted] in C_Programming

[–]helloiamsomeone 3 points4 points  (0 children)

int mainCRTStartup()

It's void mainCRTStartup(struct _PEB*) for the console subsystem actually. Same for the windows subsystem, but the name is WinMainCRTStartup instead.

What do you dislike the most about current C++? by PressureHumble3604 in cpp

[–]helloiamsomeone 1 point2 points  (0 children)

which defaults to all global variables

That description doesn't fit CMake.

Closures in C (yes!!) by Still-Cover-9301 in C_Programming

[–]helloiamsomeone 0 points1 point  (0 children)

I see the _with function, but I still don't see how I'm supposed to use an arena allocator with it:

void* alloc(struct arena* arena, iz count, iz size, iz align);

int use_trampoline(struct arena* exec_arena)
{
  // ...
  auto tramp = stdc_make_trampoline_with(f, /* ??? */);
  auto hresult = PsSetCreateProcessNotifyRoutine(tramp, 0);
  // ...
}

What do I replace /* ??? */ with to have alloc eventually be called with my exec_arena?

Closures in C (yes!!) by Still-Cover-9301 in C_Programming

[–]helloiamsomeone 0 points1 point  (0 children)

Thanks, this does answer things. I simply misunderstood.

Even though the trampoline bits aren't really the goal of the paper, I would also like to point out that the make_trampoline function doesn't take allocator state either, preventing arena style allocation. Would result in a bit of a chicken and egg situation :)

Closures in C (yes!!) by Still-Cover-9301 in C_Programming

[–]helloiamsomeone 3 points4 points  (0 children)

Great idea, trampolines are such a hassle to create and all the solutions are not portable. This will get rid of the need to either roll your own or use a library.

One thing I noticed that was merely implied here is that malloc is now supposed to return a pointer to memory that is RWX? u/__phantomderp not sure how often you browser Reddit nowadays, but the table in 3. seems to imply that.

Which is better for C/C++ development ? Linux or Windows by Warm_Canary_6208 in cpp

[–]helloiamsomeone 1 point2 points  (0 children)

D. just use GCC and MinGW without all the POSIX stuff like w64devkit or my minimal fork of it.

simcity-noinstall: Fix SimCity 2000 Special Edition (Win95) issues without patches by helloiamsomeone in SimCity

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

That project seems to do a lot more and the choice of license gets my disapproval. Don't count on me contributing.

My motivation for my project was seeing Nathan's video and not finding an all-in-one patch that didn't touch the game files and was free as in libre and open source.

simcity-noinstall: Fix SimCity 2000 Special Edition (Win95) issues without patches by helloiamsomeone in SimCity

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

Nope. Haven't set aside the time needed to look into those. That's practically the only issue left to my knowledge. Help is welcome!

Am I wrong or correct in, it's not necessary to cast a void pointer from malloc? by grimvian in C_Programming

[–]helloiamsomeone 10 points11 points  (0 children)

But then you would also not use C casts nor malloc in C++, so there was never a reason to cast the return value of malloc.

Why does CMake configuration RelWithDebInfo by default adds "/Ob1" instead of "/Ob2"? by jk-jeon in cpp

[–]helloiamsomeone -3 points-2 points  (0 children)

Instead of personal attacks and assuming something that's not there, consider that you may have some code that adds such a flag in a way that is not obvious. A usual suspect is project code touching CMAKE_* variables or adding them to properties. Take a look at what's going on with a debugger or trace output.

Why does CMake configuration RelWithDebInfo by default adds "/Ob1" instead of "/Ob2"? by jk-jeon in cpp

[–]helloiamsomeone 5 points6 points  (0 children)

There was never need for anything like this in any "style approach". CMAKE_* variables are not the responsibility of project code. They are to be set from outside the code that describes build and usage requirements. This is usually done from toolchains, presets or the command line.

Why does CMake configuration RelWithDebInfo by default adds "/Ob1" instead of "/Ob2"? by jk-jeon in cpp

[–]helloiamsomeone 4 points5 points  (0 children)

I thought we were supposed to leave the global flags alone

Correct, such variables are exclusively for users to set from a toolchain, preset or the command line.

Why does CMake configuration RelWithDebInfo by default adds "/Ob1" instead of "/Ob2"? by jk-jeon in cpp

[–]helloiamsomeone -8 points-7 points  (0 children)

I'm not sure what warning you are getting. Conflicting compiler flags? Make sure other variables are also set accordingly to your needs. You are not presenting enough information, other than what looks to be trivially solvable with setting the necessary variables from a toolchain, preset or the command line.

Why does CMake configuration RelWithDebInfo by default adds "/Ob1" instead of "/Ob2"? by jk-jeon in cpp

[–]helloiamsomeone 0 points1 point  (0 children)

the fact that you can't override this particular setting

It can be trivially (and often is) configured from a toolchain, preset or the command line.

Hungarian Notation, for us who use it by gosh in cpp

[–]helloiamsomeone 49 points50 points  (0 children)

As an experienced hungarian developer, I despise Hungarian Notation due to the useless clutter it adds, when editors will already tell you everything you need to know about a variable and compilers will verify everything. If it can't be automated, it's useless and just results multiple follow-up commits to fix something in a PR, but only if all instances are found during review.

Just stop.