« first day (184 days earlier)      last day (2669 days later) » 

11:35 AM
Hi I have an issue with my code
It's a SDL code
while (frame < 10)
	{
		for (unsigned int i = 0; i < 1000; ++i)
		{
			for (unsigned int j = 0; j < 1000; ++j)
			{
				pixels[i+1000*j] = Clamp(SF.array[i][j])*0x10000;
			}
		}

		SDL_UpdateTexture(texture, NULL, pixels, 1000 * sizeof(Uint32));
		SDL_RenderClear(renderer);
		SDL_RenderCopy(renderer, texture, NULL, NULL);
		SDL_RenderPresent(renderer);

		std::cout << "Frame " << frame << " finished rendering" << std::endl;
		std::cout << "500,500 was " << SF.array[500][500] << std::endl;

		SF.DoreanTick();
It displays all red but it the array isn't fully 255
ok so it's an issue on the clamp function apparently
here it is :
wait wait
not this one
problem solved :)
 
nwp
In software engineering, rubber duck debugging or rubber ducking is a method of debugging code. The name is a reference to a story in the book The Pragmatic Programmer in which a programmer would carry around a rubber duck and debug their code by forcing themselves to explain it, line-by-line, to the duck. Many other terms exist for this technique, often involving different inanimate objects. Many programmers have had the experience of explaining a programming problem to someone else, possibly even to someone who knows nothing about programming, and then hitting upon the solution in the process...
3
 
 
5 hours later…
5:07 PM
Ok I have a weird issue
So I have a struct:
struct parameter
{
	INT64 solver_type;

	/* these are for training only */
	double eps;	        /* stopping criteria */
	double C;
	INT64 nr_weight;
	INT64 *weight_label;
	double* weight;
	double p;
	double *init_sol;
};
 
nwp
Dec 1 '16 at 12:36, by Ven
init ALL YOUR MEMBERS
 
When I pass it by reference to a function, the init_sol member gets changed from 0x0000000000000000 to 0x3fb999999999999a. This leads to issues
however
if I change the struct so that init_sol is elsewhere in the struct, say, under weight
It gets passed fine
but if I make another member underneath, it still results in the error
 
is the calling code and the function in a different translation unit (different cpp files)?
 
recompile all the source files which include the header
 
@nwp they're initialized elsewhere in the program
 
5:11 PM
if so try a clean build
 
I rebuild the whole thing everytime I update
they are in different cpp files
 
nwp
@mmf1102 You should consider initializing members like struct parameter{ double *init_sol = nullptr; ...}; Just to be sure you didn't forget something somewhere.
 
the build system may be skipping one of the cpp files because it didn't catch the dependency to the header file
 
how sure are you the object files are recompiled?
running make? well then it's most likely a badly written makefile
make is garbage
 
I am 100% they are recompiled, and the code runs fine if I move init_sol up in the struct
 
5:16 PM
"code runs fine" doesn't mean a whole lot when it's undefined behavior
 
well it runs as intended, like in the 32 bit version
oh, right, I should mention the 32-bit version runs fine, it's the 64-bit which breaks
 
okay I'll stop playing along
Sep 12 '16 at 12:28, by milleniumbug
make an SSCCE
 
@mmf1102 "it runs as intended" doesn't mean a whole lot when it's undefined behavior
 
 
3 hours later…
user1593881
8:04 PM
All hail TCP and UDP on Linux embedded. What else in terms of client server networking is there?
 
user1593881
I've opened sockets on Windows, Linux not so much. What headers/libraries are the way to go on Linux?
 
user1593881
Long story short all of the examples I find seem to be in C not C++.
 
"BSD sockets" is the traditional API for sockets on Linux, if you want higher level then there are libraries like Boost.Asio
 
user1593881
8:41 PM
@milleniumbug Thank you.
 

« first day (184 days earlier)      last day (2669 days later) »