2011/3/7-4/20 [Computer/SW/Languages/C_Cplusplus] UID:54056 Activity:nil | 3/7 I have a C question. I have the following source code in two identical
files t.c and t.cpp:
#include <stdlib.h>
int main(int argc, char *argv[]) {
const char * const * p1;
const char * * p2;
...
|
2004/12/14-15 [Computer/SW/Compilers] UID:35291 Activity:moderate | 12/14 If I have a C function like this
void foo(void) {
static const char unused1[] = "one";
const char * const unused2 = "two";
...... some code ......
return;
...
|
2004/10/29-30 [Computer/SW/Languages/C_Cplusplus] UID:34449 Activity:very high | 10/29 C++ is so freaking BROKEN. Augh!
\_ Just use C.
\_ Would if I could.
\_ No, you are. C++ works just fine, and far better than C for many
purposes.
\_ C vs. C++. FIGHT!!!
...
|
2004/8/18-19 [Computer/SW/Languages/C_Cplusplus] UID:32995 Activity:very high | 8/18 Doesn't math.h define min() and max() functions? What should I include
to get them? I'd rather not do the (a < b) ? a : b thing. Thx
\_ No. Many programmers define it as a new macro. Don't know what
gcc people do, offhand.
\_ OS X has fmin(3)/fmax(3) which conform to ISO/IEC 9899:1999(E).
Linux might have these too.
...
|
2004/8/10-11 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers] UID:32805 Activity:high | 8/10 C question. Is there anything wrong with the following?
const my_struct_t **pp;
pp = malloc(sizeof(my_struct_t *));
pp = realloc(pp, sizeof (my_struct_t *) * 2);
"gcc -Wall" doesn't complain. But the M$ compiler (cl.exe) complains
about the realloc line:
...
|
2004/3/30-31 [Computer/SW/Languages/Perl] UID:12925 Activity:kinda low | 3/17 In Perl, how do I make variables have static types and type check
for valid parameter/actuals? I realize that variables are untyped
in Perl ($var can be 0.001 or "hello") but I'd like to have more
strict checking so that errors would be caught ahead of run-time,
Thanks, -java guy
\_ use java. Seriously. You don't use perl if you want strong
...
|
2003/12/8-9 [Computer/SW/Languages/C_Cplusplus] UID:11356 Activity:nil | 12/8 c++ question, how do I overload << in my class so it will handle
endl? ie: myclass << "some string" << endl
I know how to do the "some string" part:
myclass & operator << (const char * s);
what about endl?
Thanks!!
...
|
2003/9/10 [Computer/SW/Languages/C_Cplusplus] UID:29529 Activity:nil | 9/10 Stupid question: how do I reference a C callback?
int mycompare(void const *a, void const *b) { ... }
qsort(msg, sizeof(Msg), numMsgs, mycompare);
I get
"Type error in argument 4 to `qsort'; calling convention mismatch."
\_ There's nothing wrong in the you reference it. However, you should
...
|
2003/7/6-7 [Computer/SW/Languages/C_Cplusplus] UID:28939 Activity:high | 7/5 Besides method lookup of non-virtual methods, how is C++ considered
slower than pure C? The follow-up question: why hasn't C++ or
another OO language moved into usage in kernels and drivers?
\_ Larger standard library + linkers which link everything =
\_ You probably mean "Besides method lookup of virtual methods".
large code = poor cache performance.
...
|
|