Comment by Guillaume on keeping track of dynamic memory
@user2362377 it's because when you do the reallocation you forget to save the new int in temp
View ArticleComment by Guillaume on C intrinsics, SSE2 dot product and gcc -O3 generated...
@matovitch you should try to write down the instructions if you're not convinced. If you use pure SSE and not AVX, the register operand of the shuffle will be overwritten (it's a source and a...
View ArticleComment by Guillaume on Getting the number of CPU cores using only C standard...
The other comments are correct, they are no sure way of determining this. But they might have been looking for a program where you would spawn threads and see how many are running concurrently. This is...
View ArticleComment by Guillaume on Detect call's offset with ptrace
@IgorSkochinsky Yeah I realized that. I was just trying to avoid implementation defined behavior and forgot the casts. Edited. Thanks
View ArticleComment by Guillaume on Rounding up to next power of 2
Note that this returns the smallest power of 2 greater than OR equal to x. Changing (x -1) to x changes the function to return the smaller power of 2 greater than x.
View ArticleComment by Guillaume on Link error between C and assembly
@gregoiregentil You did not compile foo.c as c++ by any chance?
View ArticleComment by Guillaume on Does srand(getpid()) affect format / structure?
@R. time is not more predictable than getpid.. On most systems, there is only 32K possible values for the PID. You can find the pid by just running ps or looking at /proc. Your point about...
View ArticleComment by Guillaume on How to configure libstdc++ with GCC 4.8?
@DavidDoria ld.so --library-path blah just invokes the linker with that search path. It does not change the default configuration for the linker (well at least on Linux). If you want to change its...
View ArticleComment by Guillaume on C Program Hangs on Fgets after Popen doesn't work
If I run your script manually, the R process takes 100% cpu. So it's either taking a very long time or process of Ryacas is buggy and goes into an infinite loop. I am not quite sure what the expected...
View ArticleComment by Guillaume on Difference between fflush and fsync
@binki no - it calls write() on the buffered data
View ArticleComment by Guillaume on What does this mean in assembly
There is indeed an extra deref. That just means it's loading a pointer and deferencing it before writing it onto the stack. I don't think that tells you anything esp for unoptimized code. Your godbolt...
View ArticleAnswer by Guillaume for Why cant pass-by-value work if the function parameter...
You can pass a derived class by value. You cannot pass the abstract base class as an argument by value because there is no way to instantiate an abstract class.In general you want to pass by reference...
View ArticleAnswer by Guillaume for Thread Pool compile error
Is the definition of enqueue in the ThreadPool.h header? This is required for template methods
View ArticleAnswer by Guillaume for Multi Dimensional Array Implementation
Based on the code, you pasted, this should not crash. Did you forget the destructor? You should have a destructor that deletes the memory. When you have one, you need to make sure that data is...
View ArticleAnswer by Guillaume for How does TCP work on an actual system
It's a pretty broad question and it's going to depend what system you're using and what facility the applications are using.But in general, unix/windows use sockets to communicate using tcp. You...
View ArticleAnswer by Guillaume for c++: Storing an adress as string
The simplest way is to dochar buf[sizeof(void*) * 2 + 3];snprintf(buf, sizeof(buf), "%p", /* the address here */ );
View ArticleAnswer by Guillaume for NASM Assembly Programming - Incrementing an Address
%esi is a register. It can contain an address, your bank account balance or anything else. There is no way the cpu knows what kind of value it contains. inc is simply an arithmetic instruction that...
View ArticleAnswer by Guillaume for C++ Server Connection Issue
Your problem is your call to getaddrinfo(). This function returns information in the host_info_list member. What you're reading is the hint (host_info) which is not changed by getaddrinfo(). You would...
View ArticleAnswer by Guillaume for opening a file gives a sYSMALLOc assertion failure
You're not giving the declaration of sequence. Is it a char array or an int array? If it is an int array, your malloc is wrong, it would need to allocate keyword_size * sizeof(int) bytes
View ArticleAnswer by Guillaume for PHP/Linux: Does 'kill -9' equate to SIGKILL?
Yes, signal 9 is SIGKILL. You can run kill -l and see the list of signals with their number (the man page signal(7) has also more information).However this case is useless. SIGKILL cannot be caught by...
View Article
More Pages to Explore .....