2014/1/14-2/5 [Computer/SW/Languages/C_Cplusplus] UID:54763 Activity:nil | 1/14 Why is NULL defined to be "0" in C++ instead of "((void *) 0)" like in
C? I have some overloaded functtions where one takes an integer
parameter and the other a pointer parameter. When I call it with
"NULL", the compiler matches it with the integer version instead of
the pointer version which is a problem. Other funny effect is that
sizeof(NULL) is different from sizeof(myPtr). Thanks.
...
|
2009/7/21-24 [Computer/SW/Languages/Java] UID:53168 Activity:moderate | 7/20 For those who care btw, it looks like eclipse is now A Standard Tool
at UCB ugrad cs, probably replaced emacs. Furthermore, people get
angry at seeing Makefiles, (since eclispe takes care of that). I
guess it's just a sign of the times.
\_ The more people at my work use eclipse the less the code is
managable in emacs. I'm not sure which application's fault
...
|
2005/2/15-16 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers] UID:36174 Activity:moderate | 2/15 Technical question: we have a memory leak in our C code, we think,
but it's not the sort of memory leak where the memory's unreferenced.
What we'd like to do is sort of a poor-man's profile, we want
to know who calls our memory allocator "New"... Sorta like a stack
trace. Using an actual profiler is sort of difficult 'cause it's
a parallel application. Thanks, --peterm
...
|
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/9/23 [Computer/SW/Languages/C_Cplusplus] UID:33716 Activity:high | 9/23 Is the a C++ equivelent to the C realloc function?
\_ realloc(). But seriously, maybe you want an STL container
that automatically grows.
\_ Not in this case. I just need to grow a char array
automatically myself. (For speed reasons) Really, It's a
very isolated place in the code, and I'll probably just end
...
|
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/4/13-14 [Computer/SW/Languages/C_Cplusplus] UID:13175 Activity:high | 4/13 How much C++/C knowledge do recent Berkeley CS/EECS grad have?
\_ Class CSGrad inherits FromDaddy and does not implement C++Knowledge
very well.
\_ funny. just the rich and poor as always. the middle class can't
afford education.
\_ They know how to deal with pointers and addresses, malloc and free.
...
|
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/12/4-5 [Computer/SW/Languages/C_Cplusplus] UID:11317 Activity:nil | 12/4 Is there any reason to worry about mixing the usage of malloc and new?
Obviously, you can't delete() malloc'd memory (and vv), but aside from
that, will bad things happen? Oh, I should note that this is for a C
library that is used by C++ -- a coworker suggested wrapping my memory
allocations (and deletions) with
#ifdef __cplusplus
...
|
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
...
|
|