Hot answers tagged

7

No approach can be said to be "better" without the context for which it is chosen. If you have a problem to solve, be it a business requirement or whatever, you choose the approach that suits the problem. In your example, the two approaches are either a folder per employee, or a folder per data type. The second, as you said, makes managing ...


6

The differences between C and C++ are so large these days that they are two different languages that require differences in how designs are expressed in those languages. C offers one paradigm, procedural, for writing code where as C++ is multi-paradigm allowing a larger implementation vocabulary for implementing a design. You can use a procedural paradigm or ...


4

Look at this Linux kernel code, for an example of well-designed, idiomatic C code. Notice: There is hardly any direct memory allocation or freeing happening in this file. People who are good at object-oriented design but not C design often have malloc and free all over the place because they are not accustomed to minimizing that in their design. These ...


3

It's not so much the compiler that decides, but the software developers creating the compiler. And they decide that based on what makes sense for the processor, and what customers (developers who use the compiler) want. For example, if you write a C compiler for a 64 bit ARM processor, your types can reasonably be 8, 16, 32 or 64 bit based on the hardware. ...


1

but aren't designed to be extended. I'm not quite sure how much you researched the event libraries you mentioned, but they do support creating custom events. For example, with libevent, when creating an event structure, you can pass in -1 to the file descriptor to create an event that can only be triggered manually and not by IO: If events contains one of ...


1

I have heard OpenGL described as client-server architecture. You don't have direct access to the actual resources on the GPU similar to how you dont have access to actual resources on a server, just handles. You can ask the server/GPU to do things but the server might ignore or defer the action related to the actual resource. Resources may become invalidated ...


1

"As ever it was since 'C++' was a 'C' compiler preprocessor," the fundamental idea is simply "to avoid pointlessness." 🤠 The "C" programming language was – just as in the late 1970's it was intended to be – "an enormous(!) step forward from [machine-specific ...] assembly language." (And it still proves its worth: the ...


1

This is a challenging question, because the design may be influenced by the language but not necessarily: there are a lot of examples of C++ code that is written as if it was C with some syntactic sugar for type management. Everyday on SO you find students posting C++ code from their teacher that is just C with classes and not at all in the spirit of modern ...


1

There is no single correct way to add audio samples together. The samples in a (uncompressed) WAV file represent the amplitude of the sound signal at the time the sample was taken. As the top-top amplitude of the signal is also a representation for how loud the sound is, halving all the sample values will also have an effect on the volume of the sound. ...


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