what is considered best practice when referring to a program's name? i've seen
#define PROGRAM_NAME "myprog"
printf("this is %s\n", PROGRAM_NAME);
as well as
printf("this is %s\n", argv[0]);
i know, that the second approach will give me ./myprog rather than myprog when the program is not called from $PATH and that the first approac...
I am looking for c++ code coverage tool which fares well in mutli server setup and on both windows and linux without licensing issues(if non free).
I have done some research and found 2 free tools: Covtool and gcov. Any disadvantages on these or any other suggestions?
...
I get an error on line 6 (initialize my_foo to foo_init) of the following program and I'm not sure I understand why.
typedef struct foo_t {
int a, b, c;
} foo_t;
const foo_t foo_init = { 1, 2, 3 };
foo_t my_foo = foo_init;
int main()
{
return 0;
}
Keep in mind this is a simplified version of a larger, multi-file project I'm ...
Dear All,
Pardon me if you feel this has been answered numerous times, but I need answers to the following queries!
Why data has to be aligned (on 4 byte/ 8 byte/ 2 byte boundaries)? Here my doubt is when the CPU has address lines Ax Ax-1 Ax-2 ... A2 A1 A0 then it is quite possible to address the memory locations sequentially. So why ...
Hi Guys
I what know gcc compile time. gcc have any command or option for calculate compile time?
[example] I have file hello.c and then compile.I what know spent time to compile
...
I have enabled blur on my window. I have some edit fields and some custom controls and I would not want these to be affected by the blur, they are semi transparent as a result. How could I only blur the main window itself, not its child controls (sort of like Chrome). Thanks
...
For example,
Can I call a function without ()?
Thanks in advance.
...
Maybe I use inline functions...
There are any way to archieve it, without using function pointers?
Thanks in advance.
...
Like this link http://gcc.gnu.org/onlinedocs/gcc-3.3.1/gcc/Labels-as-Values.html
I can get the memory address of an label, so if I declare a label, get your address, and add your address, i will pass to next instruction? some ilustration >
int main () {
void *ptr;
label:
instruction 1;
instruction 2;
ptr =
// ...
I inherited a big application that was originally written in C (but in the mean time a lot of C++ was also added to it). Because of historical reasons, the application contains a lot of void-pointers. Before you start to choke, let me explain why this was done.
The application contains many different data structures, but they are stor...
I would like to write a text scroller on a micro-processor with 4 5x7 displays in ANSI-C.
Does anyone know of example source code or anything that can help me get started?
Update
This is the user manual for the micro-processor board I have. On PDF page 17 is a picture of the board with the displays.
The code is written in an IDE call...
I'm trying to learn about stack base overflow and write a simple code to exploit stack. But somehow it doesn't work at all but showing only Abort trap on my machine (mac os leopard)
I guess Mac os treats overflow differently, it won't allow me to overwrite memory through c code. for example,
strcpy(buffer, input) // lets say char buff...
Can someone explain to me how I convert a 32-bit floating point value to a 16-bit floating point value?
(s = sign e = exponent and m = mantissa)
If 32-bit float is 1s7e24m
And 16-bit float is 1s5e10m
Then is it as simple as doing?
int fltInt32;
short fltInt16;
memcpy( &fltInt32, &flt, sizeof( float ) );
fltInt16 = (fltInt32 &...
Why is still C99 mixed declarations and code not used in open source C projects like the Linux kernel or GNOME?
I really like mixed declarations and code since it makes the code more readable and prevents hard to see bugs by restricting the scope of the variables to the narrowest possible. This is recommended by Google for C++.
For ex...
Does mutex guarantee to execute thread in order of arriving?
that is, if, thread 2 and thread 3 arrive is waiting while thread 1 is in critical section
what exactly happen after thread 1 exit critical section if thread 2 arrive at mutex lock before thread 3, thread 2 will be allowed to enter critical section before thread 3 ?
or rac...
Is it possible to create a display list for Tesselated objects? If so would it be more efficient?
Thanks
...
It's the special property that void* can also be assigned a pointer to a pointer and cast back and the original value is received.
I read this line somewhere. Does it means void* and void** are same?
What is the difference?
Edit
void* can hold any pointer. Then what's void** needed for?
...
Between C and C++, which is easier to learn? Which is more powerful? Does either do anything special that the other doesn't?
thanks!
...
Possible Duplicate:
C vs C++ for an almost new programmer
why we need to use c++ when programming of c is easy
...
I understand that execve() and family require the first argument of its argument array to be the same as the executable that is also pointed to by its first argument. That is, in this:
execve(prog, args, env);
args[0] will usually be the same as prog. But I can't seem to find information as to why this is.
I also understand that ex...