Skip to main content
Share Your Experience: Take the 2024 Developer Survey
12 votes

Is updating a macro value in Xcode preprocessors marcos violating open closed principle?

If your requirements have permanently changed, just change the code already. Anything else - including slavish devotion to the open-closed principle - is abstraction for abstraction's sake and does ...
Philip Kendall's user avatar
9 votes

How would I go about writing my own implementation of Win32 functions?

You cannot Operating system APIs are implemented as part of the operating system. Most of them disassemble to "Set some values in some registers and then syscall and let the OS take care of the ...
Tim C's user avatar
  • 214
7 votes

Is updating a macro value in Xcode preprocessors marcos violating open closed principle?

First, make sure you have understood that the OCP is not violated at the time when you change some source code, see my answer here for a detailed explanation. The OCP is followed or violated at the ...
Doc Brown's user avatar
  • 208k
5 votes

How would I go about writing my own implementation of Win32 functions?

A sideways look at what you said about running on other OS: there is an implementation of almost all of the Windows API that runs on Linux, called WINE. You can see their implementation of these ...
pjc50's user avatar
  • 13.5k
1 vote

Is there a standard way or standard alternative to packing a struct in c?

Alluded to elsewhere, but not obvious to me until I saw it explicitly, is the option to use byte arrays everywhere. So instead of: struct aligned { uint16_t s; uint32_t i; uint8_t c; }; which ...
Heath Raftery's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible