Questions tagged [low-level]
Questions concerning low-level aspects of a system: programming close to the underlying details and hardware.
75 questions
3 votes
3 answers
281 views
Best Practices for loading primitive data types from raw bytes
On occasion, it is very useful to reinterpret raw bytes structured data - ints, floats, etc. Eamples include reading from a mmapped file, reading some sort of in-memory data frame, or other tasks that ...
1 vote
3 answers
378 views
What is the standard for heap allocators in bare metal programs?
What is the standard for heap allocation systems in bare metal programs? If there is no standard, what is the most popular one? Is it a free list? If so, are there heuristics that use a hash table of ...
1 vote
1 answer
726 views
Tagged pointers vs. fat pointers
I'm writing my own dynamic programming language. So far I've been using a tagged union for all values. Since this boxes primitive types needlessly, I've begun researching tagged pointers which seem to ...
3 votes
1 answer
444 views
Is C usually a last resort?
I've been learning C recently. I've completed a number of coding challenges on websites like codewars in C, and I always find myself wishing I had something like Python's flexible data structures. In ...
0 votes
2 answers
787 views
Payment Processor using polymorphism?
I am writing a payment Processor class, then will take different payment objects in input and talks to external services to process payment.My class is designed using polymorphism as follow: public ...
1 vote
4 answers
906 views
Using Enum to represent VehicleType in cab Booking system
I am working on low level design of cab booking type of system and feeling stuck at modelling Vehicle in Booking class.I came up with following design. Class Vehicle { } ...
0 votes
2 answers
995 views
Object Oriented Design for chess
Recently I came across some article on Chess OOPS design.Following is some snippet from it: public class Chess { ChessBoard chessBoard; Player[] player; Player currentPlayer; List<...
2 votes
3 answers
716 views
Enums or Multiple Inherited Classes
I am reading about OOD and came across Parking lot design problem.Parking lot has parking floors which has parking spots.The parking spot class looks as follow: public enum ParkingSpotType { ...
-1 votes
1 answer
366 views
Do other languages have variables shared between threads?
I guess it would be too complex for Node.js / JavaScript to leverage, but I've been working with clusters in node to break big tasks down so all cores can work at once but the inter-process messaging ...
5 votes
1 answer
742 views
How exactly are drivers developed, distributed, & utilized?
If operating systems use 'drivers' to communicate with external devices, does that then mean that OS's (like windows, linux, & osx) have to come prepackaged with drivers for every single external ...
1 vote
4 answers
978 views
Why do many programming languages and applications use integer instead of floating point to represent time?
In my experience, the value of time mostly is represented by integer number, by programming languages (C/Java/Golang/Javascript(*)...), and by databases (MySQL, Postgres...), exceptions maybe some GUI/...
17 votes
5 answers
2k views
How to comprehend abstraction in code?
When looking at a new codebase I like to start from a bottom-up approach. Where I comprehend one file and then move up to the next abstraction. But often times I find myself forgetting what the ...
7 votes
3 answers
2k views
How can arithmetic, like a bit shift, avoid branching?
I'm learning to program the Game Boy Advanced (an old Nintendo console.) I was reading one of the best tutorials about it and it said this about how branching can be done with arithmetic. [To ...
60 votes
6 answers
41k views
Why do many functions that return structures in C, actually return pointers to structures?
What is the advantage of returning a pointer to a structure as opposed to returning the whole structure in the return statement of the function? I am talking about functions like fopen and other low ...
83 votes
7 answers
17k views
Why are bit masks called "masks" and what purpose do they serve?
Why are "bit masks" called like this? I know that they are mainly used for bitwise operations and the usage of bit masks is more efficient than the usage of separate variables. However my question ...