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.
...
|
2013/4/29-5/18 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers] UID:54665 Activity:nil | 4/29 Why were C and Java designed to require "break;" statements for a
"case" section to terminate rather than falling-through to the next
section? 99% of the time poeple want a "case" section to terminate.
In fact some compilers issue warning if there is no "break;" statement
in a "case" section. Why not just design the languages to have
termination as the default behavior, and provide a "fallthru;"
...
|
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+):
...
|
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;
...
|
2011/2/5-19 [Computer/SW/Languages/C_Cplusplus] UID:54027 Activity:nil | 2/4 random C programming/linker fu question. If I have
int main() { printf("%s is at this adddr %p\n", "strlen", strlen); }
and soda's /proc/sys/kernel/randomize_va_space is 2 (eg; on)
why is strlen (or any other libc fn) at the same address every time?
\_ I don't pretend to actually know the right answer to this, but
could it have something to do with shared libraries?
...
|
2010/2/12-3/9 [Computer/SW/Languages/C_Cplusplus] UID:53708 Activity:nil | 2/12 I need a way to make a really big C++ executable (~200MBs) that does
nothing. No static initialization either. Any ideas?
\_ static link in lots of libraries?
\_ #define a i=0; i=0; i=0; i=0; i=0; i=0; i=0; i=0; i=0; i=0;
#define b a a a a a a a a a a
#define c b b b b b b b b b b
...
|
2009/8/7-14 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Languages/Java] UID:53252 Activity:high | 8/6 In C one can do "typedef int my_index_t;". What's the equivalent in
C#? Thanks.
\_ C#? Are you serious? Is this what the class of 2009 learn?
\_ No. I have to learn .NET code at work. I am Class of '93.
\_ python is what 2009 learns, see the motd thread about recent
cal courses and languages
...
|
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
...
|
2009/1/15-23 [Computer/SW/OS/OsX] UID:52398 Activity:nil | 1/15 can any serious development be done on OSX that is not *for OSX*.
i'll grant that ruby on rails has excellent tutorials for the mac.
discuss:
\_ What kind of serious development? If you want to use the standard
OSX ui then your ui code will be pretty much useless elsewhere,
but that's why concepts like MVC are so important. Otherwise
...
|
2005/8/31 [Computer/SW/Languages/Perl] UID:39376 Activity:nil | 8/31 Looking for an XML parser for Perl, preferably one that
doesn't require installation (something already built in).
If it's not already built in, I prefer something that doesn't
require C compilation, and that I can just stick the *.pm
to use. I'm looking for portability, not performance. Thanks.
\_ What's wrong with using CPAN?
...
|
2004/10/28-29 [Computer/SW/Languages/Perl] UID:34404 Activity:nil | 10/28 Has anyone had trouble building SpamAssassin 3.0.1 on RH 9? It seems
to have major problems, and I can't tell if it's SA's fault or
Redhate's. perl Makefile.PL yields a Makefile with stray single
quotes and truncated lines. google searches yield no help.
--scotsman
\_ No idea about that in particular, but can you generate the makefile
...
|
2004/9/23 [Computer/SW/OS/OsX] UID:33714 Activity:moderate | 9/23 One of the grad students I work with added a piece of code to one
of our programs that need to be dynamically linked to. He uses a
mac, and he only wrote the linking flags for the mac, and stuck
that in the makefile. So our standard linux version no longer
works. He then left for Rome. How should this look in ELF?
ifeq "$(MACOSX)" "true"
...
|
2004/3/30-31 [Computer/SW/Database, Computer/SW/Unix] UID:12939 Activity:nil | 3/30 How can I tell what has been compiled into my postfix binary?
For example, I want to see if it has mysql support built in.
\_ If you know what you're looking for, you can probably use
strings/grep (assuming you have just the binary.) Or you
could just roll your own... -John
\_ Try ldd if dynamically linked, or nm postfix | grep mysql
...
|
2004/1/16 [Computer/SW/Security] UID:11807 Activity:high | 1/16 How do you allow remote root logins on FreeBSD? I can ssh in as a
user but not as root.
\_ Same as any system, edit your sshd_config.
\_ How do I restart sshd on FreeBSD4?
\_ reboot!
\_ kill -HUP sshd
...
|
2003/11/12 [Computer/SW/Unix] UID:11033 Activity:nil | 11/11 does anyone know how to extend this makefile to support make clean
on sub dirs?? thx
.PHONY: all clean subdirs $(SUBDIRS)
all: subdirs
subdirs: $(SUBDIRS)
$(SUBDIRS):
...
|
2003/9/4-5 [Computer/SW/Compilers] UID:10081 Activity:nil | 9/4 I have a legacy make system that needs to work on several platforms
w/ different compilers. To build for platform X, you type
"make -f X_make" at the top level. I'm trying to get to a modicum
of sanity about this by actually using dependencies correctly.
The problem: I need to have dependencies in subdirectories, and
those dependencies also need to be built using the X_make makefile,
...
|
2003/5/30-31 [Computer/SW/Compilers] UID:28580 Activity:high | 5/29 There's a MIPS assembly file foo.s. It's unoptimized. The makefile
compiles it into foo.o and then links with the rest of the program.
I know there's a way to dump the actual assembly listings that is
produced by gcc -c foo.s. And this assembly is not the same as what's
in foo.s because compiler optimizes it and adds in a lot more stuff
to make it runnable. Anybody remember how to get the assembly listings
...
|
2002/11/26-27 [Computer/HW/CPU, Computer/HW/Drives] UID:26639 Activity:very high | 11/26 A serious question about this: http://www.apple.com/xserve
I have zero experience with recent apple hardware or software.
My company needs rock solid NFS hosts at low cost. Performance isn't
an issue. The clients will be Solaris 2.7 and Linux 2.4. Do any of
you have any experience with this? Does it sound good/bad to you and
why? Any info, urls, whatever is much appreciated. BTW, this isn't
...
|
2002/9/6-8 [Computer/SW/Unix] UID:25792 Activity:moderate | 9/6 Is there a way to tell emacs20 to associate a file suffix with a
particular mode? I want it to use makefile-mode for files with ".nmk"
and ".cfg" suffixes. Thanks.
\_ i have the following in my .emacs to use text-mode for
mutt's temporary files:
(setq auto-mode-alist (cons '("^/tmp/mutt-" . text-mode)
...
|
|