I experience quite annoying side-effect of class/structure padding with Purify. E.g.
struct something {
int field1;
char field2;
};
/* ... */
struct something smth, smth2;
smth.field1 = 1;
smth.field2 = 'A';
smth2 = smth;
The last line would highly likely trigger UMR warning saying that 3 bytes of initialized memory are acc...
I am working on a system that splits users by organization. Each user belongs to an organization. Each organization stores its data in its own database which resides on a database server machine. A db server may manage databases for 1 or more organizations.
The existing (legacy) system assumes there is only one organization, however I ...
I'm writing a java binding for a C code and I'm not really familiar with C.
I have a uint64_t and need to cast it to a int. Does anyone know how to do that?
(My binding returns then a jint...)
...
Hello gurus,
I am compiling some external C++ code into a dll using Visual Studio 2008.
The code is wrapped in extern "C".
Since I am cross compiling, creating a 64 bit dll on my 32 bit machine;
I am using x64 as "Active solution platform" in the "Configuration Manager".
My dll compiles and links successfully. However when I open it ...
I've created my controls in my window in the WM_CREATE message like this:
case WM_CREATE:
{
CreateWindowA("button", "Refresh Listview",
BS_MULTILINE | WS_CHILD | WS_VISIBLE, 10, 10, 70, 50,
hwnd, (HMENU)IDC_REFRESHLW, g_hInst, NULL);
break;
}
When I press tab it does nothing, do i have to in...
I have successfully compiled a C-program by GCC on Mac with GD2 library installed directly from sources. Now I am trying to do that with GD2 library installed via MacPorts and have the following error message:
plotgeometry.c:5:16: error: gd.h: No such file or directory
plotgeometry.c: In function 'PlotGeometry':
plotgeometry.c:28: erro...
Hi all,
It has been a while since I last programmed C, seems I have forgotten everything
in the meantime... I have a very simple pointer question. Assuming that I have
a function that computes a sum through loop iteration. Not only should this function
return the loop counter but also the sum it computed. Since I can just return one
val...
I'm creating a daemon that will be installed in the LaunchAgents folder. Some questions about making it sleep:
Because it's a LaunchAgent item will the executable automatically sleep when the user/system sleeps?
If the answer is yes to question 1, do I need to specify anything in the plist document?
If the answer is no to question 1, w...
Hi
Im an experienced actionscript developer, and relatively new to Objective C.
I decided a good investment of my time would be to master the C language (not C# or C++).
Can anyone recommend the 'best' online tutorials for learning C?
...
Here's an oddity from the past!
I'm writing an ASCII Pong game for the command prompt (Yes yes oldschool) and I'm writing to the video memory directly (Add. 0xB8000000) so I know I'm rendering quickly (As opposed to gotoxy and then printf rendering)
My code works fine, the code compiles fine under Turbo C++ V1.01 BUT the animation lags...
I'm working on an embedded project (PowerPC target, Freescale Metrowerks Codewarrior compiler) where the registers are memory-mapped and defined in nice bitfields to make twiddling the individual bit flags easy.
At the moment, we are using this feature to clear interrupt flags and control data transfer. Although I haven't noticed any bu...
The idea is that a game might need something fast but also simplistic. Mainly a "give me more highs or give me more lows" kind of thing. I googled whole libraries of audio processing but that might not be ideal. What do you think is the best way to formulate a very simplistic approach suitable for the quick switching for a computer game?...
I wrote a C program that starts a JVM using JNI_CreateJavaVM. The program is a Windows console application (VC 2008). JNI version is 1.6.
If I debug the program and then stop the debugging in the middle, before it reaches the call to DestroyJavaVM then the CMD.exe window remains open and I'm unable to close or kill it. If I look at the ...
Is there any difference between these:
float foo1 = (int)(bar / 3.0);
float foo2 = floor(bar / 3.0);
As I understand both cases have the same result. Is there any difference in the compiled code?
Note: updated fabs() to floor() as that was the real question
...
Hello,
I need to implement something like my own file system. One operation would be the FindFirstFile. I need to check, if the caller passed something like ., sample*.cpp or so. My "file system" implementation provides the list of "files names" as a array of char*.
Is there any Windows function or any source code that implements this ...
Hi
So far I was familiar with c and c++ only, and I have programmed in these languages only. I have some experience working on some projects in c or c++.
Some good projects or applications I've made till now:
Duplicate file finder and remover
Process monitor on Linux
Basic http proxy server
I have made one small flex application ...
I need to map primitive keys (int, maybe long) to struct values in a high-performance hash map data structure.
My program will have a few hundred of these maps, and each map will generally have at most a few thousand entries. However, the maps will be "refreshing" or "churning" constantly; imagine processing millions of add and delete m...
I have a super high-performance C/C++ data structure (see here!) that I'd like to access and use in my C# program.
Imagine the C/C++ data structure has a public API (get, add, delete, etc). How can I call these methods lots of times within C# in a high-performance way?
P.S. Before you criticize my use of the phrase "C/C++"... In my vie...
I can set the back color when i am registering the class, e.g.:
wincl.hbrBackground = CreateSolidBrush(RGB(202, 238, 255));
RegisterClassEx(&wincl);
But how would i do it to any window i have created with the CreateWindow function?
like a button on my main window, i have visual styles enabled, and i can notice the windows default gray...
How can I use a variable to specify the field length when using scanf.
For example:
char word[20+1];
scanf(file, "%20s", word);
Also, is it correct to use 20+1 (since it needs to add a \0 at the end?). Instead, I'd like to have something like:
#define MAX_STRING_LENGTH 20
and then
char word[MAX_STRING_LENGTH+1];
scanf(file, "%"MAX...