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.
...
|
2012/7/19-11/7 [Computer/SW/Languages/C_Cplusplus] UID:54439 Activity:nil | 7/19 In C or C++, how do I write the code of a function with variable
number of parameters in order to pass the variable parameters to
another function that also has variable number of parameters? Thanks.
\_ The usual way (works on gcc 3.0+, Visual Studio 2005+):
#define foo(fmt, ...) printf(fmt, ##__VA_ARGS__)
The cool new way (works on gcc 4.3+):
...
|
2009/4/30-5/6 [Computer/Theory] UID:52923 Activity:nil | 4/30 Sorting question! I have n sorted arrays of doubles. What's the
fastest way to sort them into 1 big sorted array?
\_ as mentioned below: you are describing one half of mergesort
\_ You really have to ask this question?
\_ You don't know either, huh?
\_ If three are n sorted arrays of m doubles each, I think the fastest
...
|
2009/1/26-2/1 [Computer/SW/SpamAssassin] UID:52462 Activity:nil | 1/26 Can somebody show me a procmail rule which drops email from
users {foo, bar, baz}@{host1,host2,host3}.berkeley.edu.
I dont want to have to create a rule set like this for
each combination:
:0:
* ^From: cfengine@host.berkeley.edu
...
|
2009/1/21-26 [Computer/SW/Languages/Java, Computer/HW/Memory] UID:52436 Activity:nil | 1/21 If I have a linked list of structs and many of those structs have
members that are structs then what is the best way to free() the
memory when I am done with them? I thought I would walk the list
and do a free() on each member of each struct, but that generates
errors like free(): invalid pointer, presumably because I don't
always allocate memory in each struct. No, I never took a class in
...
|
2008/7/14-16 [Computer/SW/Languages/Perl, Computer/SW/Unix] UID:50557 Activity:moderate | 7/14 Shell Programming question: I want to call a script with 1 arg
and have it figure out whether $1 is a MAC address or an IP address
and then do call the appropriate function. What is the best way
to do this, given that sh/bash/ksh do not have something like
the =~ in perl. Check for exit status of grep, or is there a
a better way? For the moment, let's just say the two tests are:
...
|
2008/7/11-13 [Computer/SW/OS/Misc] UID:50541 Activity:kinda low | 7/11 Does anyone know a way to find out all the environment variables for
a running process aside from ps? I'm doing this on AIX, and while
ps eww <pid> gives some of the environment vars, it seems to stop at
2000 characters or so.
\_ have you tried ps ewww? That works in some flavors of Unix.
\- agree with ps -e. otherwise, on AssOS, /proc/<pid>/environ ...
...
|
|