Hi guys,
Is there a good application (that has some kind of gui) for testing memory leaks in c code. I would really like to test my assignment/programme but being very new to this, i struggle with using the terminal to do things, especially using gdb for debugging (to me it feels like a blast from the past, where i could be using some v...
int main()
{
int *d=0;
printf("%d\n",*d);
return 0;
}
this works fine.
>cc legal.c
> ./a.out
0
if i change the statement int *d=0; to int *d=1;
i see the error.
cc: "legal.c", line 6: error 1522: Cannot initialize a pointer with an integer constant other than zero.
so its obvious that it will allow only zero.i want to know what...
If I have a int32 type integer in the 8-bit processor's memory, say, 8051, how could I identify the endianess of that integer? Is it compiler specific? I think this is important when sending multybyte data through serial lines etc.
...
Hi!
Previously I defined com-port number using DBT_DEVICEARRIVAL:
procedure TMainForm.WMDEVICECHANGE(var Msg: TWMDeviceChange);
var
lpdb : PDevBroadcastHdr;
lpdbpr: PDevBroadCastPort;
S: AnsiString;
begin
{Заголовок сообщения}
lpdb := PDevBroadcastHdr(Msg.dwData);
case Msg.Event of
DBT_DEVICEARRIVAL:
begin {Добавление}
if l...
I have a simple program that creates a thread, loops twenty times and then makes a call to close itself and perform the necessary cleanup.
When I debug the program it reaches the ExitThread(); method and pauses, ignoring the printf(); I have set up after it to signal to me it's closed.
Is this normal or am I forgetting to do something?...
Currently I have my private key saved in a file, private.key, and I use the following function to load it:
RSA *r = PEM_read_RSAPrivateKey("private.key", NULL, NULL, NULL);
This works perfectly but I'm not happy with the file-based format; I want to save my key in pure binary form (ie, no base64 or similar) in a char* variable and load...
See this example!
int main( int argc, char ** argv )
{
int *ptr = malloc(100 * sizeof (int));
printf("sizeof(array) is %d bytes\n", sizeof(ptr));
}
The printf function return only 4 bytes!
What is wrong?
Thanks so much!!!
...
I am writing a C program in Unix System Services on a z/OS mainframe. One of the requirements is to get a sequence number from a DB2 database residing on the same mainframe. Not having DB2 Connect available, I'm wondering what my options might be. I can open a socket on port 50000 (the default DB2 port), but, from the IBM documentation I...
Hi, i made a post earlier asking about checking for memory leaks etc, i did say i wasnt to familiar with the terminal in linux but someone said to me it was easy with valgrind
i have managed to get it running etc but not to sure what the output means. Glancing over, all looks good to me but would like to run it past you experience folk ...
I am a beginner in C. While reading git's source code, I found this wrapper function around malloc.
void *xmalloc(size_t size)
{
void *ret = malloc(size);
if (!ret && !size)
ret = malloc(1);
if (!ret) {
release_pack_memory(size, -1);
ret = malloc(size);
if (!ret && !size)
ret = mal...
see this example:
int *array = malloc (10 * sizeof(int))
Then free only the first 3 blocks?
Or make equal java, have an array with negative index, or an index that not began with 0.
Thanks a lot.
...
We have numerous projects in our organization that are mixed Python/C. Currently we're trying to standardize on a directory layout for our projects and are trying to come up with a convenient scheme. One point of contention is where to put C extension modules in the tree.
We're tossing around a couple of options (relative to project roo...
I'm looking for a way to automatically (as part of the compilation/build process) generate a "table" of function pointers in C.
Specifically, I want to generate an array of structures something like:
typedef struct {
void (*p_func)(void);
char * funcName;
} funcRecord;
/* Automatically generate the lines below: */
extern void fun...
Hi,
I want to generate two separate parsing functions from lex/yacc. Normally yacc gives you a function yyparse() that you can call when you need to do some parsing, but I need to have several different yyparses each associated with different lexers and grammars. The man page seems to suggest the -p (prefix) flag, but this didn't work f...
I need to create a simple application that doesn't work after 30 days.
How can I do that ?
Is there a way to use Trial program after 30 days ?
...
In C++ one might use namespace to keep independent groups working in the same code base from inadvertently creating functions with the same name and thus creating a conflict. My question is, before the idea of namespace comes out, how might one emulate namespace in C.
...
Is there a simple way?
...
Rather Trivial Question.
So I tried to do this:
if(array[0]=="some_string")
but obviously it doesn't work...
What do I have to do?
...
I am trying to make a few effects in a C+GL game. So far I draw all my sprites as a quad, and it works.
However, I am trying to make a large ring appear at times, with a texture following that ring, as it takes less memory than a quad with the ring texture inside.
The type of ring I want to make is not a round-shaped GL mesh ring (the "...
How do I force cpptask to move the static libraries to the end on arg list issued to the compiler?
Here is the clause I am using
<cpptasks:cc description="appname" subsystem="console" objdir="obj" outfile="dist/app_test">
<compiler refid="testsslcc" />
<linkerarg value="-L${libdir}" />
<l...