Reputation
19,722
Top tag
Next privilege 20,000 Rep.
Access 'trusted user' tools
Badges
2 38 78
Impact
~711k people reached

Apr
21
comment Is there any simpler way to check the strong level of password?
require at least 10 characters and ... That's it. Just require a long password.
Apr
15
comment Do I have to fork a server program as an “C” child process in order for correct interprocess communication to take place?
@Frank when you do "sem_open" the OS will look for other semaphores with the same name and return a handle to an existing semaphore if there is already one (creating one otherwise if the flag was set). Waiting and signaling semaphores are system calls and the kernel will deal with the exclusive access.
Apr
15
comment Do I have to fork a server program as an “C” child process in order for correct interprocess communication to take place?
Can you be sure the pthread_mutex_t doesn't have a pointer to some allocated structure that it needs to change during lock and unlock? If not then this method won't work.
Apr
15
comment Does having so many macros (#define) increase compilation time due to prolonged pre-processing?
You can do preprocessing independently from other compilation steps, so why not do some profiling on it.
Apr
5
comment Should temporary files be saved to /tmp or the current working directory?
check if the program has access and if not find another temp dir
Apr
1
comment How does cuckoo hashing guarantee O(1) lookups in presence of persistent hash collisions
@Jules it can't. The best way to guarantee the diversity is to let the salt affect the hash in a non linear way like hash(salt) { return salt*(c[0] +salt*(c[1] + *salt*c[2])); }
Mar
18
comment Should <= and >= be avoided when using integers, such as in a For loop?
@nocomprende you wouldn't, if the boundary values from your problem description are 5 and 10 then it's better to have them explicitly in the code rather than a slightly changed value.
Mar
10
comment Kernel facilities needed for C++
you'll need the runtime library. If that's linked statically it won't need anything more than C.
Mar
7
comment Is it possible to statically predict when to deallocate memory---from source code only?
@Euphoric unless you structure your program so the boundaries of when a resource is used is very clear like with RAII or try-with-resources
Mar
7
comment Is it possible to statically predict when to deallocate memory---from source code only?
look up the halting problem. It's the grandfather of why the question of "Can't a compiler figure out if a program does X?" is always answered with "Not in the general case."
Mar
3
comment What method for storing a text file in memory (c not c++) would allow me to open any format(UTF-8, Binary, etc) and a file of any size?
avoiding leaks is just a matter of knowing when you stop using the resource so it can be returned for reuse.
Feb
29
comment Merging waitable objects
Hope the api has a waitForMultiple helper function that wakes if one is signaled.
Feb
26
comment Why is there no language supporting a if..elseif..any..else construction?
@Luc us a goto then. Or put the thing in a function.
Feb
26
comment Why is there no language supporting a if..elseif..any..else construction?
@Luc The reason why elif, elsif, elseif existed was because they didn't introduce extra nesting. They often had an endif keyword at the end so a lonf else if chain would need as many endifs as there were ifs. The construct elseif removed that annoyance.
Feb
26
comment Why is there no language supporting a if..elseif..any..else construction?
It feels like the result3 is actually some kind of error handling rather than a full fledged condition. Why not early return if it happens.
Feb
26
comment Why is there no language supporting a if..elseif..any..else construction?
and just adding result4 after result1 and result2 is not an option?
Feb
11
comment How to find the cause of an exception in async code
or break on exception thrown (an option in just about all debuggers).
Feb
7
comment Encrypted content in games
A decryption key needs to be bit correct. game state will often use floating point or state that will not be bit exact (order of entities in pools not matching for example). So you'll need to compact the game state before doing any kind of keygen on it.
Jan
30
comment Polygon simplification that encloses original set of points
in other words get a convex hull (possible add some holes to it) and then triangulate it.
Jan
25
comment Can the “level 256 bug” in the game of Pacman be considered an unhandled segfault?
@B1KMusic not all buffer overruns result in a segfault. It depends on how the memory was allocated. If the memory is statically allocated (one big buffer manually split up in different zones) and the area immediately behind the last level was used for something (like sprite graphics) then it wouldn't segfault.