Computer SW Compilers - Berkeley CSUA MOTD
Berkeley CSUA MOTD:Computer:SW:Compilers:
Results 1 - 150 of 168   < 1 2 >
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2024/11/23 [General] UID:1000 Activity:popular
11/23   

2006/1/17-20 [Computer/SW/Languages/Java, Computer/SW/Compilers] UID:41399 Activity:low
1/17    Java compiler help please.  I have some code like this:
        import com.foocorp.foolibrary;
        class myClass {
          private static final boolean useFooLib=false;
          {
            if(useFooLib)
              foolibrary.FooClass.doStuff();
          }
        }
        And the problem is that if I turn off useFooLib and try to compile
        with out foolibrary.jar the compile fails.  Is there any way I can make
        this work without distributing foolibrary.jar with every build?
        \_ I haven't had to think about this for a while, but maybe you
           can use a custom class loader?  What about reflection?
           \_ Yeah, I went with that, starting with Class.forName() as
              suggested below.  Between reflection and commenting out multiple
              blocks it seemed like the lesser of two evils. Thanks.  -OP
              \_ Interesting I was not aware that javac allows you to delay
                 type checking, to see whether method doStuff() exists or not.
                 Thanks for pointing this out. Motd is great!
                 \_ Um, that's not what I said.  I used Class.forName() to
                    dynamically load the class, then I used reflection to
                    get the methods I want, then invoke those methods on
                    the class object (thet are static methods).
              \_ I think the cleaner way to do this is to create an
                 interface -- FooClassInterface. Include that in your
                 normal code path, but you don't need to provide an
                 implementation. Make FooClass implement that interface
                 then you can do:
                   if (useFooLib)
                        FooClassInterface foo =
                          (FooClassInterface) Class.forName(...).newInstance();
                        foo.doStuff();
                 I think that's preferable. - guy who made below suggestion.
                 \_ Won't work.  FooClass is a partially-obfuscated JAR
                    licensed from another company.
        \_ Java is not C. If this were C, the statement "if ..." would be seen
           as dead code due to constant propagation. However javac does flow
           analysis before optimizations so requires method/var resolution
           first and you can't possibly compile with safety without foolibrary.
           If you must include such a dead code, manually comment out the dead
           code or just include the foolibrary.class|java with the distro.
           Go compilers!!!
        \_ Don't import foolibrary. Do this:
                if (useFooLib)
                  Class.forName("com.foocorp.foolibrary.FooClass").doStuff();
2005/12/21-23 [Computer/SW/Compilers, Computer/SW/Languages/C_Cplusplus] UID:41104 Activity:nil
12/21   I have a complex chuck of C code, and somewhere it in, I'm freeing
        a bad pointer.  However, this doesn't happen if I run it under
        gdb.  Does anyone know how I can figure out where it's crashing?
        \_ Valgrind is usually pretty good at finding this stuff.  It's slow,
           though.  If the program runs under FreeBSD, you can try running it
           with MALLOC_OPTIONS=AJX.
        \_ Is it running in gdb that causes the crash or is it running
           a debug build that causes the crash?  Debug builds null all
           memory at allocation, I believe there is a way you can tell
           gcc to set all the memory to some other value than null instead.
           If all memory is nulled then freeing that null value will do
           nothing, but in the non debug mode you will free a random int
           and boom, your code will crash.
           \_ No, running in gdb DOESN'T crash.  Running it normally does.
              \_ It's obviously freeing an uninitialized pointer.  In a
                 a debug build all allocated memory is nulled so you are
                 going to free null, which is valid and doesn't cause a
                 crash.  There is a way to make debug builds (or maybe gdb)
                 not null out memory.  It has been a while since I debugged
                 c, but I know for a fact that is your issue.
              \_ try attaching to the pid after it starts?
        \_ gdb the core dump
           \_ I don't seem to have a core dump.  It just seg faults. (on
              linux)  Is there a way to force a core dump when it frees a
              bad pointer?  (Sometimes it gives an error: free(): invalid
              pointer 0x9091420!)
              \_ Don't segfaults dump core?  Do you have ulimit set to 0?
                 \_ ulimit in unlimited.  Apprently they don't always
                    dump.
                    \_ Is it setuid?  -tom
                       \_ no.
        \_ Above suggestion, and this sort of failure-to-reproduce could mean
           the bug is in something time-dependant, either using a clock, net IO
           or bad synchronization between threads.  Heisenbugs suck.
           \_ I think it's because I have lots of if(x) {free(x);} stuff.
              I could see this happening if I didn't initialize all my
              pointers to NULL.  (I understand gdb helpfully
              automatically initilizes pointers to NULL for you.) However,
              I can't find any uninitialized variables.
              \_ if (x) { free(x); } is pointless if you're using the standard
                 C library.  free(NULL) is a no-op.  Also, if it's a Heisenbug,
                 check that you're not overflowing stack frames.  If you're
                 worried about uninitialized variables, make sure you compile
                 with all compiler warnings on.
                 \_ Good point.
        \_ How about doing some good old-fashioned trace logging to pinpoint
           the crash?  Unless trace logging prevents the crash from happening
           as well!
2005/7/15-18 [Computer/SW/Compilers] UID:38645 Activity:nil
7/15    I am curious how various employers rate job performance for SAs,
        S/W engineers, and similar. Lines of code, bugs fixed, bugs
        introduced, speed, optimization, and so on all have various
        problems. Is it mostly by a gut feeling or are there good metrics
        that can be applied? Similarly, how does one determine how many
        SAs, S/W engineers, and such it might take to complete a given
        project? I've always relied on a combination of observation (for
        performance) and analogies to past projects but management would
        like something more formalized. I'm curious how you and your company
        do it. Projects could be large or small. If I need Widget X in
        one year how would you determine how many people I'd need to
        start as a rough estimate? --dim
2005/5/27-6/2 [Computer/SW/Compilers] UID:37861 Activity:nil
5/27    GDB quetion.  On Linux, When I use gdb to attach to a process that has
        many modules, does gdb automatically load all the symbol files for all
        the modules?  I'm trying to figure out why gdb itself is using so much
        memory (100MB+) on my system.  Thanks.
        \_ why shouldn't it?  100MB sounds pretty standard for projects these days.
        \_ why shouldn't it?  100MB sounds pretty standard for projects these
           days.
           days.  -- OP
           \_ Well, it's an embedded system with only 128MB of RAM.
           \_ Well, it's an embedded system with only 128MB of RAM.  -- OP
              \_ thank god for virtual memory then
                 \_ The problem is that it swaps too much which slows down my
                    threads and screws up the timing.  So it's hard to debug
                    problems that occurs only under certain timing condition.
                    --- OP
                    \_ You might want to look into remote debugging using gdb.
                       See the gdbserver and gdbreplay tools. -gm
                       \_ Will do.  Thanks!
2005/4/13-15 [Computer/SW/Compilers, Computer/SW/Editors/Vi] UID:37175 Activity:kinda low
4/13    80 column is such a 70ish idea! It's year 2005, 3 whole decades
        later.  Come on guys! It's time to move on! Let's move to 110
        columns. As our resolutions get higher and screens get bigger,
        we can easily afford the 1 column per year trend. Let the 110
        column revolution begin!  -Revolutionist
        \_ 80 columns isn't just about vt100; it is hard to visually
           scan longer lines.  -tom
           \_ You know what's even harder to read? Code that spans multiple
              lines. One statement = one line, them's the rules! It produces
              better, more holistically aesthetic code.
              \_ With Java long method and class names and all those objects
                 and fields calling().here().and().calling.there it's kind
                 of hard to avoid it sometimes. Sad.
        \_ Heathen. Submit to 80 columns or the Fortan IV compiler
           shall smite thee!
        \_ Yeah, yeah get in the fuckin truck.  Time for you to go where all
           all the revolutionists go.
        \_ 110 columns?  I thought the next supported size is 132 columns.
           \- what is the max width for "standard vi"?
              \_ I've used traditional vi on fairly wide terminals (at least
                 140 columns); it seems to work fine as long as the terminal
                 width is a multiple of the tab size.  --mconst
2005/3/30-31 [Computer/SW/RevisionControl, Computer/SW/Compilers] UID:36979 Activity:high
3/30    Is it Kosher to write a closed-source program which calles a GPL
        program on the command line but does not link to it?
        \_ Very likely yes, but people will disagree with you.  For
           instance, I'm sure there are many apps which call gcc, or
           cvs/svn (not sure about the license on the latter 2, but for
           gcc, I think it's GPL-not-LGPL.
           \_ I think it depends whether you are bundling the GPL utility
              with your program.  If you just call "mv" or whatever,
              GPL has nothing to say about that, but if you include a
              binary in your closed-source distribution, I think that's
              a violation.  -tom
              \_ What about a closed-source distribution which includes the
                 binary of the GPL as well as the source for only the GPL
                 component.  The closed-source project would just call
                 "$GPLPROG $ARGS" through a shell.
                 \_ I believe one of the complaints a lot of people have
                    about the GPL is that it requires you to open-source your
                    entire project if you use any GPL code in your
                    distribution.  So, I don't think you can use it the way
                    you describe.  -tom
        \_ This is a complicated issue. One point of view is that it is not
           only the code that is GPL'ed but also the calling interface,
           provided that the calling interface does not conform to an
           external "standard" (a non-gpl program that implements the same
           cli opts, might be a "standard" for this purpose).
           Perhaps the more mainstream point of view is that the gpl only
           applies to incorporation, ie you have one big binary in which
           some src files are gpl'ed. As long as you don't distrubte the
           gpl'ed pgm in binary only you are probably okay.
       \_ Related question: Can a function from a GPL project be included into
          a LGPL project, since the LGPL is *more* free?
2005/3/21-24 [Computer/SW/Compilers] UID:36795 Activity:nil
3/21    Is there a "skip" command in GDB?  I want to see what happens when
        I don't execute a certain command in a certain case.
        \_ I don't know of any, but you could do this:
           if (variable==1) { your command; };
           then use the set command to change the variable at your whim. --PM
        \_ If by "command" you mean "instruction in the program being debugged",
           you can use the "jump" command -- it sets the PC to a value you
           specify. -gm
           \_ I think it is clear he means a gdb command that will allow him
              to skip certain lines in the program, i.e. a pretend step.
        \_ There are hairy ways to do this ... if to break copy protection ...
           but there is no simple "skip" instruction in gdb.
        \_ jump?
2024/11/23 [General] UID:1000 Activity:popular
11/23   

2005/3/15 [Computer/SW/OS/Linux, Computer/SW/Compilers] UID:36700 Activity:high
3/15    Anyone know what I'm doing wrong?
        "In file included from fusd/test/zero.c:39:
        /usr/include/linux/config.h:5:2: #error Incorrectly using glibc
        headers for a kernel module"
        Which correct -I path should I include in the compiler? -ok thx
        \_ <kernel src dir>/include --jwm
            \_ so actually I'm using /home/user/linux-2.6.10/include
               which I downloaded from the web.
               \_ use -nostdinc
2005/3/14-16 [Computer/SW/Compilers] UID:36678 Activity:nil
3/14    We have this licenced proprietary C++ library but no source, just
        a dynamicaly-linked library and the .h file.  We have some C++ code
        that calls the library.  I'd like to be able to call this closed-source
        library from within Java.  Since I already know how to call its
        functions, can I just use System.loadLibrary("Proprietry"); to access
        this library, or do I have to make a seperate C++->Java wrapper using
        say JNI?
        \_ You have to write some JNI wrappers.  There's special code on
           both the Java side and the C side to make JNI work.  (Unless, of
           course, they have some JNI wrappers included.  Look for .java or
           .class files.) -jrleek
           \_ They have no Java wrappers and are out of business.  I guess
              I know my next project...
              \_ Well, first, make sure their libraries were compiled with
                 the same compiler as your JVM.  If it's Sun's JVM on
                 linux, it's gcc.  In order to work with Sun's JVM, the
                 library needs to have been compiled with gcc, or icc 8.1
                 or later.  Another possibility for an earlier version of
                 icc is Jrocket. -jrleek
                 \_ Presuming their libraries are compiled with some old wierd
                    obsolete compiler, if I make a JNI wrapper (in C++) for
                    their code and compile it with the right compiler, will I
                    be able to call my wrapper from Java?  Or are we screwed?
                    \_ You are very likely screwed.  Wierd stuff can happen
                       if your C++ compilers are not binary compatiable.
                       Although you may get lucky.  In my experience
                       linking gcc compiled JNI with an icc 8.0 library,
                       everything was cool as long as the library didn't
                       throw an exception. If an exception was thrown,
                       everything always crashed. No matter who threw the
                       exception or from where or who was supposed to
                       catch it.  Java can be touchy. -jrleek
                       \_ It's even worse.  If it's not the same compiler /with
                          the same options when you compile/ you're probably
                          out of luck.  -emarkp
                          \_ We have in-house C++ code that calls this old
                             library just fine when compiled with (I think)
                             the MSFT compiler.  If I compile my JNI wrapper
                             with the same compiler, shouldn't that also work?
                             This funky library just sits there processing
                             input data and never throws exceptions.
                             \_ If I may make an architectural suggestion,
                                I believe that you shouldn't be utilizing
                                JNI to call this library. Instead, I believe
                                that you should utilize CORBA and write a
                                wrapper around your library in that fashion.
                                This is especially relevant if you plan on
                                utilizing this library in the future. I realize
                                that this may be a performance hit. Again,
                                use best judgement given time/performance/etc.
                                Just a suggestion.
                             \_ It might work out for you then.  I'm pretty
                                sure the JNI on windows is compiled with
                                the MSFT compiler.  I can't really say
                                though.  I'm niether a C++ or windows
                                guru. -jrleek
                             \_ If that works, then, in the worst case, you
                                should be able to write a pure C wrapper
                                on the C++ code, compile the wrapper with
                                VC++, call the C wrapper in your JNI layer
                                and compile the JNI stuff using another
                                compiler.
2005/2/18-20 [Computer/SW/Compilers] UID:36229 Activity:nil
2/18    When you need to parse something simple do you usually use (f)lex/yacc
        or just write a recursive-descent parser? I've done both in the past,
        but I can't seem to justify using one approach over the other.
        \_ the point of yacc is so that you can write a grammar for it so that
           when things change you don't have to spend a lot of time
           rewriting your hand-written C/Java recursive-descent parser. For
           something really small then it may not be worthwhile to use the
           parser, but for something that's big (parsing a real language) it's
           best to write the grammar. You get the added advantage of the
           compiler-compiler giving you grammar ambiguity messages. The other
           thing is that flex/yacc use SLR(1) whereas recursive descent is
           LL(1). SLR(x) is more powerful than LL(x) as it can handle a
           bigger set of grammar so that's something to consider as well.
2005/2/17 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers] UID:36210 Activity:high
2/17    I need to write some code using sockets that will work on both
        Windows and LINUX.  Ideally, I'd like to just use the standard
        POSIX sockets and have the code work on both platforms.  Based on
        info from MSDN, it looks like this is possible but I'd like to
        ask people on the MOTD if they've encountered any inconsistencies
        or other issues doing things this way.  Thanks.  -emin
        \_ It mostly works, except for a few little things (WSAStartup,
           closesocket, ioctlsocket, etc.).  As long as you're not doing
           anything complicated, a few #defines are all you need.  --mconst
        \_ What language?  (I assume C or C++.)
           Which compiler on Windows?  Which on Linux?
           What are your library options?
           \_ Sorry, language=either C or C++ is fine, compilers=Visual C/C++
              on Windows and gcc on LINUX, library options=whatever I need
              to get it to work, but preferably standard stuff.  Thanks. -emin
              \_ I recommend wxWidgets (formerly wxWindows).  It's got sockets
                 and should compile on both platforms without source code
                 changes.
              \_ Someone else recommended sdl_net a while ago, but beware: it's
                 LGPL.
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
        \_ Not sure about parallel application, but how about looking into
           ccured? It reads in code, analyzes it, then generates another C code
           with annotation that could be useful. Never used it myself though.
        \_ I've heard very good things about Purify but it is not free. Also
           take a look at other tools used for Mozilla development:
           http://www.mozilla.org/projects/xpcom/MemoryTools.html
           Please tell us which tools you ended up using and what you thought
           about it, thanks!
           \_ seconded.  it's been years, but I recall purify being able to
              summarize how much memory was allocated by what code very much
              like op is asking, e.g. counts of how many times a particular
              calling context was used to hit malloc.  don't recall whether
              there were limits to how many levels of caller it tracked.
        \_ What is your platform (OS, version, etc.)?  What is your compiler
           (vendor, version, etc.)?
            \_ It's definitely a problem with our code.  Three compilers,
               3 platforms:  gcc 3.2 linux, HP cc on 21264, xlc on AIX.
               \_ The Boehm Collector is free, and can be used to detect leaks.
                  http://www.hpl.hp.com/personal/Hans_Boehm/gc
        \_ valgrind is free, Linux only
           \_ I thought you said Viagra
2005/2/7-8 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers, Computer/SW/WWW/Browsers] UID:36090 Activity:moderate
2/7     http://www.cs.ucla.edu/~kohler/pubs
        Read the first paper. Not too technical and quite readable. I hope
        it gets accepted into the prestigious WMCS, C&I conference.
        \_ That rules.
        \_ i guess it's nice to know that it's not just me.
           \_ Heh, ditto that. Maybe Phillip should write up a more in-depth
              study on the subject?
        \_ Cute.
        \_ The log graph on page 10 rocks.
        \- Did you actually submit that?
           \_ PROFESSOR Kohler doesn't have a csua account.
2004/12/20-21 [Computer/SW/Languages/Java, Computer/SW/Compilers] UID:35368 Activity:kinda low
12/20   Has anyone used the parser generator JavaCC?  Is it just me, or is
        it completely awful?
        \_ what do you need it for? If you need to use the visitor and
           traverse the syntax tree, I recommend JTB, available here
           http://compilers.cs.ucla.edu/jtb  It is built on top of
           javacc and generates visitors that you can extend functionalities
           on. There are tutorials you can use, here:
           http://compilers.cs.ucla.edu/jtb/jtb-2003           -kchang
           \_ I'm using it at work, I don't really have a choice about it.
              A parser was written in it long ago by a guy who didn't know
              anything about parsers, and now I have to update it.
              \_ well, what's awful about it? What does it not have that
                 yacc and bison have?
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;
        }
        Is a compiler allowed to optimize away both unused1 and unused2?  When
        I do this in M$ C/C++ v13, it only optimizes away unused2 but not
        unused1.  I can't find any compiler switch to tell it to throw away
        unused1.  Any idea?  TIA.
        \_ I'm not certain of this, but I think the static declaration is
           preventing the compiler from optimizing away unused1.  If memory
           serves, internal static variables, external static variables, and
           global variables are all stored in the same region of memory
           (though I could see how alternate implementations are possible).
           Thus, at a certain point in the compilation process, static
           variables become indistinguishable from global variables.  Local
           variables are much easier to optimize away than global variables.
           I'm guessing that the optimizer either lacks the context needed
           or simply isn't smart enough to make the distinction so it doesn't
           even bother trying to optimize unused1 away. -dans
           \_ A compiler can optimize away any code if it doesn't affect the
              program.  You describe a common implementation but one that isn't
              required by the standard.  This is really a QoI question (Quality
              of Implementation).
        \_ v13?  What is that?
           \_ I meant Version 13.
              \_ And what is "Version 13" of an MS compiler?  Is that the
                 version of cl.exe for Visual Studio .Net?
                 \_ It's the version of cl.exe that comes with my DDK.
                    "Microsoft (R) 32-bit C/C++ Optimizing Compiler Version
                     13.00.9176 for 80x86"
                     \_ Okay, that's from Visual Studio .Net (7.0), not the
                        latest from http://VS.Net2003 (7.1).  Just checking.
2004/12/9-10 [Computer/SW/Compilers] UID:35230 Activity:high
12/9    c++ question: is this supposed to trigger a catch?  Or do I
        have to explicitly throw an exception for there to be something
        to be catch'ed?  My own testing shows that it doesn't throw
        any exception on its own, not sure if I'm doing something wrong.

        try {
                ....
                char*c = new char[1000000000];
                strcpy(c,"blahblahblah.....");
                ...
        }
        catch (...)
        {
                cout << "Out of memory or null ptr exception?" << endl;
        }
        \_ g++-compiled programs will automatically throw an exception;
           VC6, no.
           \_ VC6 was released before the C++ standard was ratified.  In the
              standard, when new fails, it throws an exception.
           \_ Ah, I'm using Watcom C, which probably isn't up-to-date on the
              recent standard changes.  Thanks! -op
              \_ Uh, the standard was ratified in 1998 IIRC.  Not exactly
                 recent.  However, many compilers allow 'nothrow' by default
                 for backwards compatibility.
                 \_ By compiler standards 1998 is probably still "the future".
                    \_ Actually, are there ANY C++ compilers that are
                       fully compliant with the standard?  I remember
                       there weren't when I checked a year ago.
                       \_ You were wrong then.  Comeau C++ has been compliant
                          for at least a year (using the EDG frontend).  MS C++
                          7.1 (.Net 2003) is very compliant, missing only
                          export and exception specs.
2004/11/11-12 [Computer/SW/Compilers] UID:34830 Activity:nil
11/11   On a *nix machine with both cc and gcc, is there a generic way to find
        out which include directories they use?  (I think cc uses .h files in
        /usr/include and gcc uses those somewhere else.)  Thanks.
2004/10/21 [Computer/SW/Compilers] UID:34258 Activity:nil
10/20   When I compile gcc with the -g option, my binary becomes bigger
        because I have extra debugging information for the debugger.
        Let's say I'm writing my own primitive debugging tracker that
        looks at offsets of variables (both global and local), how
        do I read those debugging info? In another word, how do I
        fetch those debugging information in a text readable format
        without running or using the debugger? Thanks.
2004/10/3-4 [Computer/SW/Compilers] UID:33894 Activity:nil
10/2    Is there a way to disable specific warnings in gcc?
        \_ Use the source, Luke!
        \_ Even easier than source, use the manual, info gcc.
           \_ I did.  It doesn't help.  It describes command-line options to
              disable a few specific warnings, but it doesn't describe any
              general mechanism.  I guess what I'm looking for is something
              like MSVC's #pragma warning(disable:xxxx)
              \_ from the man page,
                      -w  Inhibit all warning messages.
                 \_ Read the whole thread.  It's not that long.  I'm looking
                    for a general mechanism to disable *specific* warnings
                    (and preferably in a specific file, or better yet, in a
                    specific section of code).  I don't want to disable all
                    warnings.  That'd be retarded.
                    \_ It's more retarded to just ignore some warnings in
                       a single file.  If it's a single file, FIX it.
                       Apologies if this sounds harsh; I'm actually
                       yelling at most of my coworkers.  Btw, which
                       warning?  Why is it unfixable?
        \_ gcc foo.c |& grep -v unwanted_warnings
2004/9/16-17 [Computer/SW/OS/Windows, Computer/SW/Compilers] UID:33574 Activity:kinda low
9/16    I want to compile a simple Windows console app, are there any
        gnu/free compilers for windows that would do it? I'd rather not
        install visual studio and all its crap... my app is in C and calls
        windows APIs.. thanks.
        \_ I'd say Cygwin but it probably doesn't support your Windows calls.
           Just out of curiosity, what sort of console app could you write
           that uses the Windows (as opposed to POSIX or something) API?
           \_ I have calls that access the windows registry...
           \_ Cygwin supports all standard Win32 calls.  --sky
        \_ MS's C++ compiler is free now.  If you want free as in speech,
           you can look into mingw (which is better than cygwin in that the
           produced binaries don't require the cygwin DLL). --jameslin
           \_ LPTSTR, LPCTSTR is not defined?? geez, I have to define them
              manually? Seems like a lot of windows constants are not defined
              ie, windows.h, etc...
              \_ In my SDK installation both are defined in WinNT.h.
        \_ borland has free older compilers, but I'm not sure if they
           support the window api's.
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:

        t3.c(12) : warning C4090: 'function' : different 'const' qualifiers
        t3.c(12) : warning C4022: 'realloc' : pointer mismatch for actual
        parameter 1

        Thanks in advance.
        \_ Your code is correct.  The warnings above are both wrong, and in
           fact the same compiler recognizes the code as safe in C++ mode
           (which is stricter about const).  --mconst
        \_ I'd ask why GCC isn't complaining.  Consts shouldn't change.
           It might be that because there's nothing between the malloc and
           the realloc, GCC is noticing that the value of pp does not actually
           changem while MS sees you are writing to a const and bitches.
           \_ But what I'm trying to realloc is an array of variable pointers
              to constant structures.  The array elements (pointers to constant
              structures, const my_struct_t *) are not consts and do change.
              It's just that the structrues that the array elements point to
              (const my_struct_t) don't change.  I think it's just stupidity on
              M$'s part, but I just want to make sure.
              \_ YMWTS http://www.parashift.com/c++-faq-lite/const-correctness.html
        \_ You sure you're not compiling in MS as a cpp file?
           \_ It works as a CPP file -- see above.  --mconst
           \_ My file is a .c, and I compile like "cl t.c" with no options.
              I tried both version 12 and version 13 and they gave the same
              warning.
        \_ Where is the 'function' name declared?
        \_ BTW, pp = realloc(pp, ...) is a bad idea.  If realloc fails, you've
           just clobbered your old copy of pp and no longer can free it.
           --jameslin
           \_ Yeah I know.  The above was just to illustrate the type checking
              warning.  But thanks.
        \_ Does it still complain if you do something like:
           typedef const struct foo *pfoo;
           ...
           pfoo *p;
           ...
2004/8/6 [Computer/SW/Compilers] UID:32738 Activity:high
8/6     I'm trying to find the true dependencies that a particular shared
        object has on other shared objects. Are there existing tools that
        can do this automatically? Otherwise I was thinking of just using
        nm and grepping out the undefined references and then correlating
        that to the defined symbols in the other object files. Thanks
        for any tips.
        \_ like ldd, or are you trying to find out exactly which functions?
           \_ yeah, sorry. i mean actual symbols. if you ask the compiler
              to link in spurious shared libraries (that your other
              library doesn't really depend on), i think it will. so ldd
              won't give an accurate answer in that case.
        \_ nm + perl is your best bet
              \_ nm -u
2004/6/22 [Computer/SW/Compilers] UID:30957 Activity:nil
6/22    GCC macro question: If I create a macro that contains, say, __LINE__,
        will __LINE__ be set to the line at which my macro is used or the line
        at which it is #defined?
        \_ I think it'll be the line at which it is #defined.  Oops, I just
           tried it out and it's actually the line it's used.  Maybe the K&R
           book says something about this.  I don't have one here.
2004/6/6 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers] UID:30635 Activity:nil
6/5     How does typedef get compiled into machine code?
        \_ what the hell are you talking about?  C?  It doesn't.  It's merely
           a type alias.  C compilers don't even do strict type-checking
           against typedefs; what makes you think it gets to the machine code
           level?
        \_ It doesn't get that far.  The answer to your question is closer
           to "How do ints, floats, structs, etc. get compiled into machine
           code?"
2004/5/28-29 [Computer/SW/Compilers] UID:30481 Activity:nil
5/28    I just found out that bison inserts these lines of code
                #ifndef __cplusplus
                #ifndef __STDC__
                #define const
                #endif
                #endif
        between the function declaration line and the actual definition lines.
        That's causing compiler warnings about "const" not matching for my
        function which has a parameter of type "const char*".  Why would bison
        want to define "const" to nothing?  I'm writing C code.  Thanks.
        \_ I think "const" was introduced in C89.  Non-ANSI compilers (i.e.
           ones that don't define __STDC__) may not support it.
           \_ I'm using at the command line "Microsoft (R) 32-bit C/C++
              Optimizing Compiler Version 12.00.8168 for 80x06" which is pretty
              recent.
              \_ I'm not sure why it doesn't define __STDC__.  Maybe you have
                 some non-compliant compiler extensions enabled or something.
                 If you want, you could try defining it yourself as a compiler
                 argument.
2004/5/21-22 [Computer/SW/Compilers] UID:30345 Activity:very high
5/21    I was not a CS major and never took the compiler class.  What is
        a good book to help me write a compiler?  And what about interpreter?
        Do they basically involve the same issues except code generation and
        optimization?
        \_ Use the book by Robert Mak, called "Writing Interpreters and
           Compilers in C++." It's a practical, hands-on "lab" type book which
           doesn't get bogged down in too much theory. It's a lot of book to go
           through, but if you pace yourself and follow the examples you'll
           have a good, practical knowledge about writing interpreters and
           compilers. I would avoid theory books such as the Dragon book since
           from what you've indicated you probably want practice over theory,
           (I doubt you're planning to write the next ocaml or haskel or some
           other junk language that will never see the light of day...) Also,
           compilers and interpreters are no longer written in the sense that
           you think of. Nowadays people use metainterpreters/compilers to
           build stuff like this (i.e. lex and yacc).
        \_ Oh God!!! Here we go with everyone responding about how great the
           dragon book and CLR are.
           \_ Let me be the first to say what a piece of crap the dragon book
              was (is).  It's written so badly it often took me 5-6 reads to
              understand a paragraph, often requiring me to diagram what the
              author was writing.  The book seems to go to great lengths to
              avoid clear examples too, which makes it more fun.
                \_ agree, this book uses the most cryptic English ever.
        \_ You should take basic CS classes before reading the compiler book.
           Otherwise it'll be easy to get lost. Do you know regular/push-down
           and other Chomsky-hierarchy shit? If not you better get to know
           them before you get into compilers.
           \_ agree on basic CS courses, I dunno what chom-whatever was, and
              I still got thru this course. you basically need to know data
              structures and be reasonably decent at programming.
        \_ I took CS164 (w/ Hilfinger, no less) but by the time I graduated, I
           totally forgot most of the stuff I learned. What are some actual
           applications of writing a lexer/parser as opposed to taking
           something off the shelf or just putting together a very simple
           language that is easily parsed by Perl?
           \_ None whatsoever, since it's already been proven that current
             languages (C, Pascal, scheme, lisp, forth or any fully functional
             ALGOG type language) are as powerful as langauges can get. In
             other words all modern computer programming languages are
             essentially equivalent and it is impossible to write a more
             functional language than what is already out there. The
             people who are trying to invent new languages are merely
             wasting time and are essentially arguing about style rather
             than substance. --williamc
             \_ Not exactly. Though programming languages that are Turing
                Complete are equally powerful, some are more expressive
                than others -- this is something you can quantify using
                a model like Denotational Semantics.
                      \- if you think the dragon book is confusing, have you
                         tried reading anything by Christopher Strachey? --psb
                \_ That's true, certain languages are definitely more apt
                   at doing certain things than others (i.e. you can do
                   things in Perl much more quickly than in C or Java and
                   vice versa). However, the point is that there isn't
                   anything that really requires another language that
                   isn't already out there. We've been at OOP for what,
                   the past 20-30 years? Pattern programming has never
                   really taken off except in very fundemental class
                   design. So what's really left to "invent" in a
                   new language? If you argue for better parralleism
                   for MPAs I'd say we had languages like that with
                   Modula 2/3. --wllliamc
                   \_ One idea I was toying with was separating 'object' from
                      'data structure' in the language.  The language library
                      provides mathematical objects for you to use:
                      (graphs, sets, trees, etc), and changes the
                      implementation (at compile time) depending on how they
                      are used, in the same way that databases do query
                      optimization.  I don't think this has been done yet.
                      I think the field of 'improving tools' for programmers
                      and people representing knowledge is wide open. -- ilyas
                      \_ The Self virtual machine will change the machine
                         code implementation of your data structure depending

                         on how it is used. And in a prototype-based language,
                         like Self, it's pretty easy to define interfaces
                         that change behavior as you use them.
                         \_ I think what I want is for the compiler to do this,
                            not the programmer.  Say if you use a set but only
                            iterate over it, an array will do, but if you do
                            random access, you want a hashtable.  A compiler
                            can figure these things out, and substitute the
                            right data structure, while a programmer can think
                            about properties of sets themselves.  It's cool
                            that self does this, but I wonder if it does
                            'complexity analysis' to figure out what data
                            struct to use like "this set is accessed randomly
                            a linear number of times, so we want a data struct
                            which supports random access in constant time", and
                            so on.  These are the kinds of decisions a
                            programmer makes, and it would neat if occasionally
                            the compiler could take over this job. -- ilyas

           Actually, looking back, I think part of the reason I don't remember
           anything is that I took it with Hilfnger and was too busy
           deciphering his project specs and doing the projects and not busy
           enough learning the theory and applications... but at least I can
           still pick up something like the Java or JVM spec and understand it.
           \_ Manycompiler/interpreters are for some very specialized language.
           \_ Many compiler/interpreters are for some very specialized language.
              It only has one application, and you might not even recognize
              it as a programming language.
2004/5/18 [Computer/SW/Security, Computer/SW/Compilers] UID:30276 Activity:nil
5/18    http://anitaborg.org/events/careers_in_cs.htm
        Women in Computer Science, sponsored by Google.
2004/5/12-13 [Computer/SW/Editors/Emacs, Computer/SW/Compilers] UID:30198 Activity:kinda low
5/12    Are there any emacs modes for .l files (lex) and .y files (yacc)?  I'm
        running emacs20.  Thanks.
        \_ just use c-mode or c++-mode.
2004/5/11-12 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers] UID:30151 Activity:low
5/10    On a 32 bit architecture, if I declare something boolean or byte,
        does it still use 32 bits, or is it possible to have a different
        offset for the alignment to pack it more efficiently? ok thx.
        \_ For boolean, it's all up to your compiler.  For byte, most likely
           it's 8 bits, but it's still up to your compiler.
           \_ I heard that if the alignment isn't 32, either the arch
              would raise an off-alignment exception, or that there is
              a tremendous run-time penalty for the memory access. Is
              this true, and which architectures would this apply to?
              \_ memory alignment has nothing to do with this, since
                 you're presumably not trying to load a 32 bit word
                 from an arbitrary offset. if bool is implemented as
                 a char, then typically it's 8 bits and alignment
                 doesn't matter. x86 allows loading words from arbitrary
                 offsets, but there can be a significant performance hit,
                 whereas many mips style chips just do not allow it.
                 \_ To clarify this: the 32-bit alignment the previous poster
                    was worried about is only for 32-bit data values.  If you
                    have an 8-bit piece of data, it only needs 8-bit alignment.
              \_ The OpenBSD guys were saying that Sparc64 was their
                 preferred dev/testing arch b/c it has strict memory
                 alignment requirements; i386 less so.
              \_ On i386 or above, if you use 32-bits and it's not 32-bit
                 aligned, there is a performance penalty but no exception.
                 If you use 8 bits, I think for some instructions there is a
                 performance penalty just from using 8 bits instead of 32 bits
                 (excpet on the SX-variant processors.)  However, I think there
                 is no additional performance penalty if the 8-bit datum is not
                 32-bit aligned.
        \_ Do you mean 'bool' and 'char' in C++?  Or some other language?
2004/5/9-10 [Computer/SW/Compilers] UID:30117 Activity:nil
5/9     In gcc how do you force a binary to be build even though there are
        undefined references, which you know will never be called during
        runtime? ok thx
        \_ That's normally a linker setting - for instance on Solaris, using
           native ld (not gnu ld), you'ld want the -z nodefs flag passed to
           the linker during the link phase (and probably -z lazyload so it
           doesn't complain when you try to run it).  I don't know the GNU ld
           flag.  -alan-
        \_ from the archive:
        What's the flag to gcc that will ignore "undefined reference"?
        \_ isn't this an error and not a warning?  how can you ignore it?
          \_ well if you know a symbol is never referenced then you can
             get away with it. I did the same thing with ctwm. I forgot
             which flag you use for linking and ignore symbol not found,
             I just rtfm but I can't seem to find it anymore.
             \_ you can fake an empty definition
        \_ This is standard behavior on VM.  I didn't know you can do this on
           Unix.
2004/5/6 [Computer/SW/Compilers] UID:30060 Activity:high
5/6     I've been out of school for too long.  If I want to write a simple
        compiler, what tools do I need besides yacc and what do they do?
        Thanks a bunch!
        \_ well there's also lex (flex) for the lexical analyzer (tokenizing).
        \_ java or c? if c, lex/flex=good tokenizer. yacc/bison are great
           for grammar. both are LALR so they're pretty powerful.
           \_ I'm not actually writing a compiler.  What I really want is to
              generate some C code that can read simple script files and
              perform some actions.  For example, if the C code reads this
              file:
                        REPEAT 10
                            DELAY 3
                            FOO
                        END
              it'll perform a for-loop 10 times calling sleep(3) and foo().  So
              I thought what I need is pretty much the front part of a
              compiler.  Thanks for any help.
              \_ I've been going through this with guys at work who always
                 want to add scripting capabilities to their apps.  Check out
                 SWIG; it lets you call scripts from C code and vice versa,
                 and your scripts can be python, perl, ruby, java, lisp, scheme,
                 whatever you want to allow.
2004/5/6 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers] UID:30054 Activity:moderate
5/6     I'm trying to use "#define errno WSAGetLastError()" in a winsock
        file, but the compiler says errno is already #def'ed.  I can't
        just run cpp on the file--it's a crappy ide-based compiler--so
        I'd like to do something like printf("errno"), but of course that
        just prints "errno" instead of the preprocessor's notion of what
        errno is #def'ed to.  What should I do instead?
        \_ errno is already defined because it's part of the c-library.  Do
           One of the following:
           call perror() : This will print an error description to stderr
           use strerror(errno) to get the error string and print it however you
           want
           use strerror_r(errno, mybuffer, mybuffer_length) to put the error
           string into your buffer mybuffer
           \_ Sorry, should have explained myself a bit more-- this is a socket
              protocol wrapper file that's compiled into windows, unix, cygwin,
              and vxworks objects.  I'm doing a lot of
                rc = select(...);
                if (rc && EWOULDBLOCK == errno) { /* handle blocking error */
              so I really need the #def to work correctly.  I could just undef
              errno for winsock and then re-#define it, but I'd like to know
              what it evaluates to first.
        \_ Many compilers allow you to compile only the preprocessor step.  For
           instance, with Visual C++ 6 you can add "/E" to the compile options
           and you'll get the preprocessor output in the build window (and .plg
           file).
        \_ May I ask why you need to alias WSAGetLastError() to the preexisting
           #define errno?  Why not use a different label?
           \_ Every library except winsock uses errno to report the error, so it
              seemed relatively natural to keep it consistent.  I guess I could
              use MY_FOO_ERROR instead, but that would require a #else to the
              #ifdef _WINSOCK_H.  Also, I'm kinda curious how to print the
              evaluated macro at runtime.
        \_ if you really wanted, you could #undef errno first.  I don't see
           what using a crappy IDE-based compiler has to do with anything;
           it doesn't stop you from running cpp.  Anyhow, if you want to see
           what errno is #define'd to, see this:
                http://www.eskimo.com/~scs/C-faq/q11.17.html
           --jameslin
           \_ Thanks, this is exactly it.  Errno was #def'ed to *_GetErrno()
              and I didn't want to #undef it if it was already "magically" set
              to WSAGetLastError by <winsock.h>.  Also, running cpp on the file
              says that errno was #def'ed to *__errno().
2004/4/30-5/1 [Computer/SW/Compilers, Computer/SW/Languages/C_Cplusplus] UID:13508 Activity:moderate
4/30    Quick C++ question. In Meyer's More Effective C++, Item 22, he has
        a snippet of code like this:

        template<class T>
        const T operator+(const T& lhs, const T& rhs)
        {
          return T(lhs) += rhs;
        }

        My question is, why is it legal to do 'T(lhs) += rhs;'? T(lhs) yields
        a temporary, which is AFAIK, an rvalue, so since operator+= is not a
        const member function, the compiler shouldn't allow that line. My
        reading of the C++ standard seems to support my line of thought. But
        OTOH, g++ 3.4.0 happily accepts code similar to the above. So am I
        missing something here? Thanks.
        \_ T(lhs) is calling the copy constructor, which returns an object;
           I don't think it counts as a temporary.  Not sure though.
           \_ No, T(lhs) is the functional cast expression, which may call a
              constructor (but not the copy constructor).  Section 5.2.3/1 of
              the standard says that T(lhs) (that is, a type followed by parens
              and a single argument) is equivalent to (T)lhs.  5.4/1 then says
              that (T)lhs for a REFERENCE type is an lvalue, but for a
              non-reference type it's an rvalue. -emarkp
              \_ I agree with what you say, except for the part where you say
                 a copy constructor can't be called. That's illogical, and I
                 don't see where the standard says anything about that anyway.
                 \_ Well, that's the only part that isn't clearly in the
                    standard, so I'm glad you agree with the rest. :)  Anyway,
                    the standard says that: T(x) is equivalent to (T)x, which
                    any compiler will turn into a noop if the type of x is T.
                    I guess one exception for this would be if the type of x is
                    T const.  In which case I guess it would call the copy
                    constructor if T is not a reference type.  T *is* a
                    reference type in the example though. -emarkp
                    \_ Oops, my bad.  Yeah, this would call the copy
                       constructor (what was I thinking?) because of course lhs
                       can't be modified, but since lhs is a reference type the
                       copied object is an lvalue.  I'm sure this is one of the
                       screwy type rules that was made precisely for operator
                       overloading.  Sorry for the screwup. -emarkp
                       \_ Hmm, I don't think so. lhs may be of reference
                          type, but T(lhs), which is the same as (T)lhs, is of
                          type T, which is not necessarily a ref type. -op
                          \_ Okay, section 3.10/10: An lvalue for an object is
                             necessary in order to modify the object except
                             that an rvalue of class type can also be used to
                             modify its referent under certain circumstances.
                             [Example: a member function called for an object
                             (9.3) can modify the object.]  So it *is* being
                             copied, and it *is* an rvalue, but non-const
                             member functions can modify an rvalue of class
                             type.  -emarkp
                             \_ That's nasty, but thanks! -op
        \_ Ob: And this is why C++ sucks.
           \_ I agree it is often way too complex, but it has its moments. -op
           \_ Ironically, the reason this is so complex is so that it will work
              like you expect, or in a way that a compiler can optimize well.
              \_ Disagree.  At a certain point of complexity it's no longer
                 economical to expect anything.  All of this would be irrelevant
                 with T.add(lhs, rhs).
                 \_ Are you arguing against overloaded operators?  In your
                    expression, where does the sum go?
                    \_ It's returned as an instance of of T.  I'm not being a
                        smartass here, I'm just wondering about cases where
                        operator overloading saves anything more than a few
                        characters of function name.  What's the real win?
                       \_ Operator overloading is essential to having
                          user-defined types that don't feel like second-class
                          citizens. "Smart pointers" would be syntactically
                          ugly and cumbersome to use if you couldn't overload
                          pointer-ish operations, for example. I'm sure there
                          are lots more examples when you start using c++ as
                          more than just "a better C".
                          \_ To whoever asked why ocaml syntax is so warty
                               -- in part because ocaml has no operator
                               overloading.  I sometimes wish it was there,
                               but I am not holding my breath.  The ocaml way
        \_ Perl.
                               is that the operator can only be the same if
                               the underlying algorithm is the same (so for
                               instance they have +. for floats and + for ints,
                               but < for both floats and ints).  So they have
                               'polymorphism' instead of 'overloading'.
                                 -- ilyas
2004/4/20-21 [Computer/SW/Compilers] UID:13293 Activity:nil
4/20    What is __attribute__ used for in gcc?
        \_ do 'info gcc' and search for it, duh.
        \_ Encyclopedia Galactica (aka google) found this for you:
           http://gcc.gnu.org/onlinedocs/gcc-3.3.1/gcc/Function-Attributes.html
2004/4/9-10 [Computer/SW/Compilers, Computer/SW/Unix] UID:13121 Activity:nil
4/9     Anybody using Eclipse's CDT package?  Is it possible to sync the
        gdb view with the current code that is being executed?
2004/4/7 [Computer/SW/Compilers, Computer/SW] UID:13052 Activity:nil
4/6     Has anyone been able to get the "certificates" auth stuff working
        for localhost connections to the admin web ui of CUPS? I would
        appreciate a pointer to sample config with this working (or instr.
        on how to do it). tia.
2004/2/16-17 [Computer/SW/Compilers] UID:12274 Activity:kinda low
2/16    How do I figure out which macro defines my compiler is automatically
        using? I need to do some conditional compilation based on platform or
        compiler (g++ on Cygwin on W2k) and I'm looking for something that
        that compiler defines that other compilers do not.  Is there command to
        g++ that will list all of this for me?
        \_ g++ -dM -E - </dev/null
        \_ yes.
2004/1/21 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers] UID:11861 Activity:nil
1/20    Any candidates for the best way to prevent developers from #includeing
        a header file accidentally.  Aside from very loud comments to that
        effect, what is a good way to make the compiler complain?  I was
        thinking something like
        #ifndef MYLIB_I_REALLY_WANT_TO_USE_THE_PRIVATE_INTERFACE
          // best way to cause compiler pain goes here
        #endif
        at the top of the private header file.  This has to be straight C for
        various reasons (I do prefer C++ and Java).
        \_ #include Your_error_message_here
           \_ Cannot find file Your_error_message_here
           \_ If you want to raise a preprocessor error, there's a mechanism
              for that: it's called #error.  #error Don't include this file.
              Anyhow, if you want to restrict access to, say, structure
              internals, you can do:
                #ifdef MYLIB_I_REALLY_WANT_TO_USE_THE_PRIVATE_INTERFACE
                    struct st
                    {
                        int field;
                    };
                #else
                    struct st { };
                #endif
        \_ Document your code and fire any developers who ignore specs.  If
           they're ignoring something this major, they will hose your source
           even worse somewhere else.
2003/12/15 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers] UID:11455 Activity:low
12/14   Sorry about this, but about alternative to the Dragon Book in the
        subject of Compiler.  What is the name of the author for that
        Programming Language book again?
        \_ the Tiger Book by appel- a much better read.
        \_ Michael Scott.  Here's the Amazon link if you want to read
           some reviews: http://tinyurl.com/z9rx
           \_ thanks
           some reviews.
2003/12/12-13 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers] UID:11427 Activity:nil
12/11   Is there something like __FILE__ or __LINE__ macro that will give me
        the class / method name in C++?
        \_ it can't be a macro, because the preprocessor doesn't know anything
           about classes or functions.
        \_ __FUNCTION__, __PRETTY_FUNCTION__ in gcc, __func__ in C99
           \_ gcc 2.95.4 on soda accepts __func__ too.
2003/12/11-12 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers] UID:11404 Activity:moderate
12/10   I am not a programmer so this question may be stupid.  What does
        @"A string (might be empty)" mean in a gcc?
        \_ The '@' character has no meaning other than '@' in standard C.  Look
           at the documentation for your nonstandard compiler.
           \_ What's the meaning of '@' in standard C?  I have no C book
              near me and I can't find it in the documentation either.
              \_ It isn't standard C syntax. If you post a code snippet with
                 a usage example maybe we can guess what it is.
              \_ Sorry I wasn't clear.  The '@' is not an operator, token, etc.
                 It's just another character, like '1' or '8' or '\' and has no
                 special meaning at all.  However, it *does* have a special
                 meaning in C#.  Specifically it means a verbatim string
                 literal.  See:
                 http://www.softsteel.co.uk/tutorials/cSharp/lesson4.html#3
        \_ Please give more context.  Otherwise it looks like the program
           may be run through a custom pre-processor (@ is expanded to
           something else) before being passed to gcc.
        \_ What's the source language? Objective-C?
        \_ I think @ means something in Objective-C... unicode string maybe?
           \_ Apparently an "NSString" object: http://csua.org/u/58b
           \_ It means several things in ObjC. @"..." is a way to
              create an NSString literal, but it's used in other places,
              e.g., @class to predeclare a class name, @interface ... @end
              is how you declare a class, etc.
              \_ Thanks.  Now I realize that the version of documentation
                 stored on my computer is outdated.  It does not define the
                 @"string" directive even though it is is already in use by
                 then.  Actually it is still not in the grammar section
                 of the current documentation as far as I see.
                 http://tinyurl.com/ytlp (developer.apple.com)
                 \_ What variant of C are you using exactly?
                    \_ I am reading some Objective C codes for Mac.  As there
                       is no standard whatsoever for Objective C, I should
                       really say codes for the gcc compiler that comes with
                       OS X.  I am confused why this compiler can
                       be called gcc: NSString is part of Cocoa, which
                       is not GPL or open source.
                        \_ NSString is part of GNUStep which is open src:
                           http://tinyurl.com/ytlw (gnustep.us)
                           Also there are some "standards" docs for the
                           language:
                           http://pages.cpsc.ucalgary.ca/~burrellm/objc/objc.pdf
                       \_ It probably should be listed in the grammar, but
                          you will find it here: http://csua.org/u/58h
                          This static string syntax, I believe, is an ObjC
                          thing, and not an Apple extension (GNUStep
                 as far as I see.
                          docs refer to it too), but I couldn't test it
                          it out on soda, as I couldn't find the Foundation
                          header files.  http://csua.org/u/58i
2003/12/11-12 [Computer/SW/Compilers] UID:11403 Activity:nil
12/10   I never took a compiler class.  I would like to at least start to
        get some light reading on my own to get started.  Are there any
        "Compilers for Dummies" books out there?  The Dragon Book is too much
        for me.
        \_ The Dragon Book is too much for most people.  It seems to
           intentionally avoid clear explanation.
        \_ May want to check out Programming Language Pragmatics by Michael
           Scott.  My gf used it for her compiler class.  I haven't read
           it, just browsed through it, and it seems well organized, the
           writing clear, with things explained and motivated in
           a straight forward manner.  It's still a thick book but I think
           you can just read and read and get enlightened without
           getting stuck.  I wish I had it when I took cs164.
           \_ thanks.  I will do that.  I have read  other Programming
              Language book before, so it shouldn't be that bad.
                                                --kngharv
2003/12/8-9 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers] UID:11359 Activity:low
12/7    Is there any reason to use bzero over memset(foo, 0, sizeof(foo))?
        \_ ANSI!  ANSI! is the STANDARD! C runtime library.
           (use memset instead)
           \_ Is ANSI the standard or is K&R (in the K&R C book) the standard?
              I've always been using the K&R book as reference when I want to
              write portable code.
              \_ K&R 2nd edition has a big "ANSI C" label on the cover.
                 I think "K&R C" refers to K&R 1st edition.
        \_ On some systems bzero used to have an optimized assembler
           implementation. If you are not concerned with speed, stick
           to memset() since it is part of C89.
           \_ Wouldn't those systems also have a quick compiler check to
              call the assembly when the second arg was 0?
2003/10/31 [Computer/SW/Compilers] UID:10875 Activity:nil
10/30   What is __P()?  I've seen the DragonFlyBSD guys crowing about finally
        getting rid of it.  What does it do?
        \_ Hackery for allowing old K&R non-prototype compilers to work
           with ANSI/ISO C89 prototypes in headers.
           \_ How does it work?  Links?  It's hard to get anything in google.
        \_ look at sys/cdefs.h, and then look at how it is used.  Like
           was said before it is there to allow old non-prototype compilers
           to work with prototype code.
2003/10/24-25 [Computer/SW/Mail, Computer/SW/Compilers] UID:10768 Activity:nil
10/24   Are there any pitfalls involved in using sendmsg/recvmsg over
        send/recv?  I finally got my problems solved with basic sockets,
        and I'm looking for a good way to say "these bytes are msg1,
        these are msg2" etc.  Thanks
        \_ These are two separate issues.  (1) man sendmsg.  (2) Since
           TCP is byte-stream oriented, you will need to introduce some
           message delimiting mechanism.  Common ways are LF (like SMTP,
           POP3, BGP) and having predictable message lengths
           (e.g., constant for all messages, having an early size field
           which indicates the size of the message, having an early type
           field which you associate with a given size, etc.).
           http://tangentsoft.net/wskfaq/articles/effective-tcp.html
           \_ Thanks for the link.  I've been using a length-header so
              far, but I was thinking that perhaps MSG_EOR would be a
              better solution.  I can't use the delimiter option b/c the
              module must also handle binary data, and I have no
              guarantees on length either.  I guess I'll stick w/ what
              works.
              \_ You can come up with a prefix code for your
                 messages.  This can be a good idea for reasons other than
                 getting rid of delimiters (since a good prefix code will
                 compress what you send over the wire). -- ilyas
                 \_ I thought you had to have a known alphabet to do that.
                    And the binary data is totally unknown.
                    \_ If it's binary data, the alphabet is {0, 1},
                       by definition. -- ilyas
                        \_ kinda hard to compress 1 & 0, isn't it?
                           \_ I think you are unclear on the concept.  Files
                              you compress with gzip are 1s and 0s, and they
                              compress just fine.  -- ilyas
                              \_ I understand the concept, but if you can't
                                 predict the expected distribution of your
                                 data (even at the byte level) you probably
                                 won't achieve much compression-- yes, I'll
                                 probably get some compression just by using
                                 a standard english distribution, but not
                                 enough to make it worthwhile.  You are
                                 correct in the technical sense, but it's not
                                 enough to break what works right now.
                                 \_ Sure you will.  It's what universal source
                                    coding is all about.  Why do you think it
                                    works on files, where we can't predict
                                    the distribution either?  At any rate, the
                                    original point of using a prefix code in
                                    your case was to get rid of delimiters.
                                    The compression (which will occur to
                                    entropy in the limit, trust me) is just a
                                    pleasant side effect.  -- ilyas
2003/9/19-20 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers] UID:10257 Activity:nil
9/19    I have something like this:

        unsigned char a;
        char b;
        unsigned short c;
        short d;

        if (a < 9999999) {}
        if (b < 9999999) {}
        if (c < 9999999) {}
        if (d < 9999999) {}

        When I compile this with gcc 2.8.1 on SunOS 5, it only complains
        "comparison is always 1" for b and d, but not a or c.  Why?  Thanks.
        \_ Perhaps in converting 99999999 to a signed char or signed short
           the compiler wraps the number around the max (i.e. takes it
           mod the max value) whereas for unsigned data types it saturates.
           Another possibility might have something to do with the fact that
           99999999 is negative for signed char and signed short. -emin
           \_ I see.  I just tried 65537 and I got the same result.  Same for
              gcc 2.95.4 on soda also.
              \_ Try 65535.
                 \_ Same result.  But in this case, not complaining about the
                    'c' line makes sense because the comparison is not always
                    1.
        \_ from gcc 2.95.2 on sparc:
   % gcc -o foo foo.c
   foo.c: In function `main':
   foo.c:7: warning: comparison is always true due to limited range of data type
   foo.c:9: warning: comparison is always true due to limited range of data type
           try b < 127 and d < 32677
           --jon
        \_ Arrr!
           \_ Avast!
2003/9/17-18 [Computer/SW/Compilers] UID:10234 Activity:nil
9/17    For this snipet of code:
        for (i = 0; i < 3; i++) {
            printf("\n\n0x%x %d", ptr++, *ptr);
        }
        Is there anything machine dependent about the evaluation of ptr++?
        I tried this on sparc/solaris and *ptr prints out the value AFTER
        the ++ increment.  But on a MIPS CPU, *ptr evaluates to before the
        ++.  WTF?
        \_ wtf is that you should learn c better. the order of evaluation
           of arguments is implementation-dependent, so a compiler
           is free to do whatever.
           \_ And this is the winner.  The comma operator evaluates left to
              right (as in: (a=b, ++b) works just fine).  However functions
              can evaluate their arguments in any order.  I don't understand the
              need for people to do this anyway.  Add the '++ptr' on its own
              line.
              \_ |>|_||>3!!  7|-|475 4|\| 3><7R4 |_i|\|3 0F <0|>3!!!!1!!
                 R34|_ |-|4X0R5 |/\|R173 5|\/|4|_|_ <0|>3!!!!1!|
                 \_ to match their 5|\/|4|_|_ heads (both of em)?
        \_ http://www.embedded.com/story/OEG20020429S0037
        \_ From the C9x Standard (section 5.1.2.3):
                "The  grouping  of  an  expression  does  not
                 completely  determine  its  evaluation ... the
                 actual increment ... can occur at any time
                 between the previous sequence point and the
                 next sequence point"
           In your case, this means that ptr++ could occur
           either before or after printf(); and both would
           be completely valid (even in the same program).
        \_ this C or C++ code?
           \_ :-)
           \_ I won't apply for your job unless you tell us which one!
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,
        not Makefile or Y_make.  Is there a way to specify this without
        actually setting up a target for each subdirectory that does
        "cd subdir; make -f X_make; cd .." ?  Thanks in advance.
        \_ make depend?  or "makedepend"?
2003/8/28-29 [Computer/SW/Compilers] UID:29504 Activity:nil
8/28    IBM has released a beta C/C++ compiler for MacOS X:
        http://www-3.ibm.com/software/awdtools/ccompilers
        http://www14.software.ibm.com/webapp/download/search.jsp?go=y&rs=vacpp3
2003/8/16 [Computer/SW/Compilers] UID:29368 Activity:high
8/15    Are there significant C compilers out there that really don't support
        C++ style "//" comments?
        \_ No. So whomemever is requiring the use of /* */ only in whatever code
        \_ No. So whoever is requiring the use of /* */ only in whatever code
           can be safely ignored. The only time you'd limit this is if you are
           stuck on a stove-pipe system.
           \_ C99 added '//' comments.  The only compilers I know of that might
              have trouble are legacy/embedded compilers.
2003/8/6 [Computer/SW/Compilers] UID:29251 Activity:moderate
8/5     I'm contemplating on getting a set of Cleveland or Ping Irons. What
        are the pros and cons of using graphite vs. steel? And should I get
        flex/regular/stiff? Thanks motd god.
        \_ get steel shafts, and the flex depends on your swing speed which
           is typically measured with your driver and 5-iron.  you can get
           this done at any shop.  and i've used ping irons and cleveland
           wedges, and they're both fine, it's just what you're more
           comfortable with.
        \_ what is your handicap?
        \_ if you have to ask you don't know
2003/7/15 [Computer/SW/Compilers, Computer/Rants] UID:29042 Activity:nil
7/14    http://www.cnn.com/2003/TECH/biztech/07/14/moves.offshore.ap/index.html
2003/6/30-7/1 [Computer/SW/Compilers] UID:28870 Activity:moderate
6/30    Follow-up question to the Academy of Arts thread last week. Someone
        posted this answer:
                           \_ If you want to make $$$ then learn Inferno/Flame.
                              My gf worked for a large FX house and the
                              Flame artists all cleared $200K+. Maya is
                              good to know, but less specialized.
        Any info on why Flame is in demand, and what are some FX houses
        that use Flame? -thx
        \_ There are fewer artists who know it, therefore they make more $$$.
           Part of it is that it is expensive to buy. Any kid can sit down
           and fool with Maya. Flame is UNIX-based, which throws a lot of
           people off, too. My gf's company was Digital Domain, the company
           that did Titanic, A Beautiful Mind, Apollo 13, Backdraft, and
           others. --dim
           \_ I also want to mention #1 talent needed is artistic. People take
              classes to learn all the software and want to be digital artists.
              That's only enough to get you grunt work. You have to have the
              artistic talent. They would hire people who submitted drawings
              who had hardly TOUCHED a computer and turn away people who knew
              all of the software but still no talent. Imagine someone going
              to ITT and then wanting to be a software engineer. They know
              how to use the compiler, right?
              all of the software but had no talent. Imagine someone going
              to ITT and then wanting to be a software engineer. He knows
              how to use a compiler, right?
2003/6/26-27 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers] UID:28847 Activity:moderate
6/26    What's a "constant function" in C?  I ran across this term in the gcc
        man page.  Thanks.
        \_ look at the info page. const functions are a gcc extension. gcc
           assumes the function has no side effects and subjects it to
           common subexpression elimination, for example when you call it
           in a loop. -ali
2003/6/25-26 [Computer/SW/Compilers] UID:28839 Activity:high
6/25    When yacc man page refers to "LR(1) parser", is LR(1) a reference to
        some other man page or does LR(1) have some other special meaning?
                -clueless
        \_ some other special meaning, LR(1) is a style of parse tree
           generation that has certain limitatations.  Sort of like how
           reg exps can't search for all the things you want to search for
           because they can only do context free searches (at least I think
           that is the limitation of regexps, it has been a while.)  Take 172
           or 164 to learn more.
           \_ LR(1) -> Left to right (scans input left to right) and builds
              a Rightmost derivation in reverse by looking at one (1) input
              token at a time. (yacc is actually a LALR(1)- Look Ahead, Left
              to right, Rightmost deviation, One input token beastie. See
              also Bison.)
               \_ oooooo!
        \_ Take 164.
2003/6/13-14 [Computer/SW/Compilers] UID:28728 Activity:nil
6/12    What are compiler intrinsics?
        \_ obgoogle, etc.
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
        from a foo.o object file?  I tried playing with GDB but can't seem
        to find the options to do this.  Thanks.
        \_ no disassemble #5!
           \_ Reference to "Short Circuit" duly noted.
        \_ gcc -S, but I think you're barking up the wrong tree.
           gcc is not optimizing your code, it is just calling
           the assemble and then the linker.
        \_ objdump -d
            \_ YES!  Thank you very much.  I love the motd.  :-)
               \_ And we luv yermom. It's all good.
                             \_ When everyone starts to love yermom
                                that's when it becomes a tragedy of
                                the commons.
        \_ this sounds like a violation of the DMCA.
           \_ how is reverse engineering his own assembly code a violation of
              anything? i think you should be violated for being stupid.
              \_ it's not his code.  he's reverse engineering the compiled
                 output from someone else's program.  DMCA violation.  you
                 can think anything you want, you'd still be a criminal.
                 \_ he has foo.s, he has foo.o which he generates using
                    gcc and foo.s. he can disassemble foo.o and take a
                    look at what gcc did with his foo.s without violating
                    the DMCA.
2003/5/12 [Computer/SW/Compilers, Computer/SW/Languages] UID:28412 Activity:kinda low
5/11    What is "software pipelining"? Is that like multithreaded stuff
        doing the same task on different processors? I understand hardware
        pipelining completely (took cs152), but don't understand what
        software pipelining is. ok thx.
        \_ It's a way of reducing loop overhead (much like loop-unrolling).
           SW pipelining works by taking replicating the loop body several
           times and staggering them in such a way that the instructions
           appear in reverse order in the loop body but none of the
           instructions have any dependencies within the same iteration.
           This helps place distance between dependent instructions. The
           major problem with SW pipelining is that you need a really
           smart compiler to realize this and there's some startup and
           cleanup code you need to tag on.

           Original Code
           -------------
           L1: lw  $1 <- MEM
               add $2, $1, $1
               sw  MEM <- $2
               bc  L1

           SW Pipelined Code
           -----------------
               lw  $1 <- MEM
               add $2, $1, $1   lw  $1 <- MEM
           L1: sw  MEM <- $2    add $2, $1, $1   lw  $1 <- MEM   bc L1
                                sw  MEM <- $2    add $2, $1, $1
                                                 sw  MEM <- $2
                \_ so does this require VLIW (issueing 3 cmds in 1 cycle?)
                   \_ I wrote it in column format to illustrate how to
                      convert the original code into SW pipelined code.
                      It has nothing to do with multi-issue.
                   \_ Multi-issue helps. There's two big reasons to SWP.
                      One is to take advantage of more instruction-level
                      parallelism (ILP), because you're running more
                      instructions concurrently. But even if you don't have
                      multi-issue, you can still get better latency tolerance
                      by interleaving instructions from other iterations
                      while waiting for a long-latency instruction to
                      complete (in the example above, the load [lw] might
                      take a long time to return).
        \_ one way people use the term is in threaded programming models,
           where you have a thread (or pool of threads) to handle a specific
           task which then passes work on to another thread/threads.
           \_ comment on my reply, the above poster has the more common usage.
2003/4/10 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers] UID:28060 Activity:high
4/9     Right now I have tons of snippets like
        sprintf(errmsg, "Error %d: invalid type %d at %d\n", 1, myType, time);
        QueueError(errmsg);
        Is it possible to define a macro to take an arbitrary # of arguments--
        #define ERROR(x) sprintf(globErrMsg, x); QueueError(globErrMsg);
        Or will the x in the macro just take everything up to the first comma?
        \_ #define ERR(args...) {sprintf(g_errMsg, args);QueueError(g_errMsg);}
        \_ Yes, if you use recent gcc or other C99-ish compilers, no for
           older ones.
        \_ A reliable method for doing this is to write a function that
           uses a va_list and vsnprintf:

           #include <stdarg.h>
           void Error (char *err, size_t sz, const char *fmt, ...) {
                va_list vl;
                if (err == null || sz <= 0)
                  return;
                memset(err,'\0',sz);
                va_start(vl,fmt);
                vsnprintf(err,sz,fmt,vl);
                va_end(vl);
                QueueError(err);
           }

           BTW, You should really avoid sprintf since it doesn't have a
           good way to check thesize of the input buffer.
           \_ thanks for the code, I'll give that a try today.  One question--
              this is a real-time application, so there are a few common stdio
              calls I use regularly and the rest are viewed warily.  Are there
              any non-constant performance implications for using vsnprintf?
              I can handle a +foo hit, but foo*strlen(err) might be pushing it.
              thanks.
           \_ that only matters if the content of your variables comes from
              input.
           \_ thanks for the code, I'll give that a try today.  One
              question-- this is a real-time application, so there are
              a few common stdio calls I use regularly and the rest
              are viewed warily.  Are there any non-constant
              performance implications for using vsnprintf? I can
              handle a +foo hit, but foo*strlen(err) might be pushing
              it. thanks.
                \_ vsnprintf calls vfprintf internally. In most cases
                   sprintf also calls vfprintf internally. The same
                   non-constant performance issues you may have with
                   your implementation of sprintf will most likely
                   apply to your implementation of vsnprintf.
           \_ that only matters if the content of your variables comes
              from input.
                \_ Program defensively.
2003/2/21 [Computer/SW/Compilers] UID:27474 Activity:nil
2/20    I'm gonna install spim on my Linux box. How do I generate MIPS code
        when I don't have access to any old DEC/MIPS based machines?
        \_ Build a cross compiler.  Check out the cs 162 web page, they
           may have a gcc binary that is capable of cross-compiling to mips
2003/2/14-19 [Computer/SW/Compilers, Computer/SW/Languages/C_Cplusplus] UID:27419 Activity:low
2/14    Is there any way other than using "_asm" to access x86 registers as
        variables in C code compiled with MS C++ Compiler version 12 or 13?
        (In the BC++ for DOS, for example, I can use "_AX".)  I tried
        http://msdn.microsoft.com but couldn't find anything.  Thanks.  -- yuen
        \_ What is wrong with _asm, is it bad?
           \_ No, but I just want to do something like "if (_AX = 3) {...}".
              If I use "_asm" blocks I need multiple lines and a label. -- yuen
             \_Something seems fundamentally wrong with this kind of statement.
               Specifically,  mixing C and assembly that way just doesn't work.
               I really think you must load the AX register into a short
               variable, then test the contents of that variable. Otherwise
               you may not get what you intend.
               \_ Okay, I'll do that.  Thanks.  -- yuen
2003/2/2 [Computer/SW/Compilers, Computer/SW] UID:27281 Activity:high
2/2     i'm getting a "cc1: warnings being treated as errors" as I try to
        compile this thing. But i don't WANT warnings treated as errors.
        How do i make it stop?  (specifically i'm getting a  "warning: implicit
        declaration of function `exit'" message but that's not the point.)
        \_ how are you compiling it? this is gcc?
           \_yes. From the make file : "gcc -O2 -Wall -Werror"
             hey, i bet if i take out that With error flag, it might do the
             trick eh?  I bet if had just looked at the damn make file in the
             first place i could have figured it out.  O.k. if i had a clue
             stick i'd beat myself with it, but i seem to have misplaced mine.
2003/1/26-27 [Computer/SW/Compilers] UID:27202 Activity:nil
1/24    Speaking of C++, I was working on refreshing my memory on it using
        Soda, and I had a problem with the cin.getline() function.  It
        gcc claims not to have a function that inputs into a sting object
        only one that uses a char buffer.  But even then it doesn't work
        completely correctly.  We have Gcc 2.95 here, is that too old?
2003/1/14-17 [Computer/SW/Compilers, Computer/SW] UID:27094 Activity:high
1/15    Back to Mirzaian's strongly polytime LP claim. The link to the
        announcement has vanished from his webpage (although the file itself
        is still there, http://www.cs.yorku.ca/~andy/pubs/Announce.doc).
        Would the original poster (or anyone in the know) care to comment?
        \_ Apparently not.
        \_ Looking into it, stay tuned. - OP
        \_ We ll find out by February. - OP
           \_ Which we, why February, and what will we find out? Or did you
              mean by January 28th? If so, then that still wouldn't explain
              the disappearance of the original announcement.
2002/12/3 [Computer/SW/Compilers] UID:26695 Activity:high
12/2    What does the following struct mean?
        struct { instr_t :18, _i:1, :13; } u_i;
#define i_i u_i._i
#define getI(x) (((((uint32)(x)) << 18)) >> 31)
#define putI(x) ((((uint32)(x)) << 31) >> 18)
        \_ it means you should read up on bit fields.
        \_ Hi paolo!
           \_ Ok, I give up.  Why is this funny?
           \_ Especially because paolo doesn't log in to soda.
              \_ Well, not in the past week perhaps, but:
pst              ttyEm    63.73.217.160    Fri Nov 22 12:32 - 12:33  (00:01)
pst              ttyEH    63.73.217.160    Wed Nov 20 14:22 - 14:27  (00:05)
pst              ttyCi    63.73.217.160    Tue Nov 19 20:04 - 21:35  (01:31)
pst              ttyBS    63.73.217.160    Mon Nov 18 10:42 - 10:46  (00:03)
                 \_ yes yes that's nice.  Why is this funny?
        \_ The struct is composed of three members, one of
           type instr_t that is 18 bits, one of type _i that
           is 1 bit, and I think a signed int of 13 bits.
           This might help:
           http://www.cs.cf.ac.uk/Dave/C/node13.html
           \_ they're commas, not semicolons.  _i is the field identifier,
              not the type.  All three fields are of type instr_t, with
              the first 18 and the last 13 bits being unnamed.
              \_ As far as the macros are concerned, does the first
                 one return the value of the last 14 bits * 62?
                 I have no idea what the second one does since it
                 seems to deal with only the last bit.
                 \_ I think even the order of the bits in bitfields is up to
                    the compiler.  So getI() only works for some compilers.
                    Why does he need getI() anyway?  "foo = u_i._i;" will do.
                    --- yuen
                    \_ I would guess that it's for cases where that 32-bit
                       value got read as an integer rather than as the struct.
                       of course, this could have been easily solved with a
                       union.
                 \_ wha--?  It's not that hard to understand.  you've got a
                    32-bit value where you're only concerned with is the 19th
                    bit from the left.  getI gets that bit.  It shifts left 18
                    bits then shifts right by 31 bits (hint: there's only one
                    bit left).  putI does the opposite; it takes a value for
                    that bit and places it in the right spot in the returned
                    value.
                    \_ But the problem is that you don't know whether _i is
                       the 19th bit from the left or from the right.  You don't
                       know whether the 18-bits or the 13-bits are the more
                       significant bits.  It's up to the compiler.  -- yuen
                        \_ http://www.cs.cf.ac.uk/Dave/C/node13.html
                                Read Portability. They prefer shifting for
                                portability.
                           \_ shifting is preferable to the bitfields, but
                              I think masks would have been better than
                              the extra shifts and would be just as portable
                              (if not more so, since they wouldn't necessarily
                              be dependent on operating on 32-bit values.)
                        \_ yes.  sorry, I didn't mean to imply that it wasn't
                           compiler-dependent.  there's also the assumption
                           that there's an appropriate underlying type for
                           the uint32 typedef.  my assumption is that the
                           code is for some specified compiler and
                           architecture.
2002/11/27-28 [Computer/SW/Compilers] UID:26653 Activity:nil
11/27   jal function_foo;
        add a, b, c;
        The add instruction is always excuted.  I did some tests using
        gcc -S on some simple routines.  Sometimes I see stuff like this
        in the output:
        jal function_a;
        jal function_b;
        The compiler doesn't seem to explicitly insert a noop.  But there must
        be a noop after it.  My question is: is an noop executed by the CPU
        without the actual noop code?  Or does the assembly insert it
        automatically and I just don't see it with "gcc -S"?  Thanks.
        \_ Most ISAs do not have this branch delay slot.  Of the major
           ISAs, only MIPS (and maybe SPARC?) does.  In any case, there
           are directives that tell the assembler whether or not to
           introduce its own delay slots as needed, or to interpret the
           code as given.  I believe it is .set noreorder and .set
           reorder.
2002/9/13-15 [Computer/SW/Compilers] UID:25883 Activity:high
9/13    Any plans to install gcc-3.2?
        \_ Is there any reason to other than it's kewl and gn00?
           \_ Support for partial template specialization.  New binary format.
              Etc.
              \_ So it has kewl new features.  Is there any reason to install?
                 \_ so you can wank off to the binary's new features. duh.
                    \_ so ill guess we'll be stuck with a known-good version
                       of gcc that works just fine and does everything required
                       of a compiler until a version comes out that someone
                       actually _needs_ installed.  wank at home.
                        \_ But gcc 3.2 is binary incompatible with C++ binaries
                           from previous versions!  Don't you want to recompile
                           everything written in C++?
                           \_ and what about C99?
2002/8/22-23 [Computer/SW/Compilers] UID:25645 Activity:high
8/22    In C, Is there any advantage for writing "if (5 == i) {...}" instead
        of "if (i == 5) {...}"?  All the sample code in a book I'm reading uses
        the former style.
        \_ just code both versions, and have gcc dump the assembly out
           and compare.
           \- this is kind of interesting exercise if you really care about
              perf in some opart of your code. we noticed and older gcc
              generated diff asm for i++ and ++i in one instance where it
              really shouldnt have mattered much and there was a measureable
              perf diff. ok tnx.
        \_ It depends on the compiler but this is such a simple bit of code
           that any compiler should do the right thing no matter which way
           you do it.  Your book is a bit screwy.  Does the author say why
           they chose that style?  It's definitely non-STANDARD.
           \_ It's the "Developing Windows NT Device Drivers" book.  The
              preface explains the reasons behind other styles used in the
              example but doesn't explain the "if" style.
        \_ the former style causes a syntax error if you mistakenly
           use the assignment operator '=' instead of compare '=='.
           the same mistake in the latter style is harder to detect,
           although some compilers (gnu) can generate a warning in
           certain cases.
           \_ Yeah but who reads warnings anyway?  95% of gpl stuff compiles
              with screen fulls and still works and never gets fixed.
           \_ Good point!  That must be it.  Thx.
           \_ Yeah, that used to be the advice.  However, in around 10 years of
              programming, I've only been nailed by that a few times.  And I
              prefer my code to be easy to read.
              \_ I second that.  (5 == i) is annoying.
2002/8/8 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers] UID:25522 Activity:high
8/8     Why do people declare functions as "static" all the time in C?
        \_ one of the reasons is that static makes the function local
           to the file.
           to the file.  Similar to a private method in C++ or java.
           \_ So that's just a linker issue? Preventing namespace collision?
              \_ that's one of the reasons.  There are probably more, but
                 that's why I like to use static in C.
        \_ Another is because some lame compilers barf if you declare a
           function that doesn't have a prototype unless it is static.
2002/4/4-5 [Computer/SW/Compilers, Computer/SW/OS/Windows, Computer/SW/Unix] UID:24320 Activity:kinda low
4/3     Has anyone tried Cygwin? How is it?
        \_ If you're willing to put in the effort to get it configured and
           running you'll get a decent system.  A friend of mine compiled and
           ran apache on cygwin/nt with numerous mods for a production server.
           It 'worked' but I would not do this in any place I cared about.  I
           provide this only as an example of what can be done, not what should
           be done.  Think of the children!
        \_ If you're willing to put in the effort to get it configured
           and running you'll get a decent system.  A friend of mine
           compiled and ran apache on cygwin/nt with numerous mods for
           a production server. It 'worked' but I would not do this in
           any place I cared about.  I provide this only as an example
           of what can be done, not what should be done.  Think of the
                                           Lorelai, is that you? _/
           children!
        \_ My laptop dual boots to Linux/Win2K. I got sick of rebooting
           to do development, so installed cygwin and use it to this end.
           I'm doing my whole 162 project using it this semester and
           haven't encountered any problems. I even got the mips cross-
           compiler to work using cygwin gcc (thanks to this guy:
              http://upe.cs.berkeley.edu/~jeffpang/cs162 )     - rory
        \_ If you want a half broken UNIX environment on your Windows
           system, Cygwin is the way to go. If you are just interested
           in a half broken UNIX environment, just install '1337 GN00
           L1NUX instead.
2001/11/9-10 [Computer/SW/Compilers] UID:22990 Activity:high
11/9    Do the 386 and 486 versions of SETI@home work on 386 or 486SX PCs
        without a 387 or 487SX?
        \_ "Back in the day", you had to either get a math co-proc or the
           software had to be written to use software emulation which meant
           it would run at 1/10th the speed or so for things that normally
           required a math co-proc.  What's the point of grinding out a unit
           per 2 months anyway?  By the time you get your unit in, they'll
           have already given up on your client/unit pair.  As far as seti
           goes, it depends totally on how they wrote it.  Try it.
           \_ I know it depends on how they wrote it, or more likely, what
              compiler switches they passed to the compiler.  But since I
              don't have a 386/486SX PC, I can't try it out myself.
              \_ Then why do you care?
                 \_ Okay, I'm just curious.
        \_ Surely you've got better things to do than provide horribly
           energy-inefficient computing power to SETI with negligible
           results.
           \_ Hey, at least it's not a 8088 or a Z80.
           \_ It was either inefficient cycles going to SETI or wasted idle
              cycles.  Which one is worse?
           \_ It was either inefficient cycles going to SETI, or wasted cycles
              running idle loop or drawing flying toasters.  Which one is
              worse?
                \_ Turn the fucking thing off, duh.  Just because it still
                   works doesn't mean it should be on.
                   \_ Dude, chill.  It seems unlikely that the wasted power
                      from an old machine is going to matter all that much
                      in the grand scheme of things.  Try decaf next time....
                   \_ What about the wasted idle cycles when you're typing in
                      your source code, or your compiler is reading a file from
                      the hard disk or over the network, or you're downloading
                      something from the web, or your debugger is waiting for
                      the target machine to hit a breakpoint?  I power on my
                      PC at work 8 or 9 hours a day, and at the end of the day
                      I usually find that only 10% of the CPU cycles went to
                      the ocmpilers/browser/OS etc, whereas the other 90% is
                      idle cycles which I use to run SETI@home.
2001/10/17-18 [Computer/SW/Compilers, Computer/SW/Languages/C_Cplusplus] UID:22763 Activity:high
10/17   Is "const volatile" or "volatile const" a valid type qualifier in plain
        C?  I want to define something for some read-only hardware registers.
        I'm wondering if something like
                typedef struct {
                  const volatile int reg1, reg2, ......;
                } myRegs, *myRegsPtr;
        will do the trick.  I want the fields to be read-only but I don't want
        the compiler to optimize away any read operations.  I tried compiling
        the above and there's no error, but I don't know if it'll always
        compile to the right thing.  Thanks.
        \_ If the HW registers are read-only then you shouldn't need to do
           anything like const.  Just do volatile reg1, reg2, etc. This stuff
           is memory mapped right? So when you write to hardware locations
           that are read only, nothing will happen. When you read it back it
           will still get the read-only value.  (If the HW is designed
           correctly).  Things get trickier if you're using this struct to
           keep a shadow copy of the registers due to some ASIC bug.  But
           generally, read-only means exactly that.  Read-only.
           \_ Does "const volatile" actually mean anything then?
           \_ Yes it's memory mapped.  I realize I don't need to use "const",
              but I just want to use it so that the compile will generate an
              error when someone accidentally writes code to assign a value
              to that location.
              to that location, just like what it does for an ordinary const
              variable.
        \_ Yes, it's defined in standard C, and it does exactly what you
           want: you're not allowed to assign to the variable (const), but
           the compiler will read the value from memory every time you
           access it (volatile).  --mconst
           \_ You need volatile mconst.  -John
2001/10/8-10 [Recreation/Computer/Games, Computer/SW/Compilers] UID:22669 Activity:moderate
10/8    How can one obtain a console development machine and
        compiler?  Can you simply pay Sony/Nintendo for a
        the hardware/software?
        \_ traditionally, you need to submit your game proposal first,
           and if approved, then you sign an NDA and then pay for the
           development hardware and software. for hobbists, Sony had
           development hardware and software. for hobbyists, Sony had
           the NetYaroze (PSOne) program and now PS2Linux in Japan.
           these two would allow you to program technology demos on
           \_ you also need to spend thousands of dollars
           the hardware, but not full-fledged bootable games. --jwang
           \_ what is the difference in the developing a tech demo
              and a bootable game?  Is the Playstation development
              tool the same?
              \_ licensed PlayStation 2 developers use different hardware and
                 costs of entry to reflect commercial vs hobbist interests.
                 software tools than PS2Linux users -- the two have different
                 costs of entry to reflect commercial vs hobbyist interests.
                 \_ the word is "hobbyist." A Hobbist is a follower of Hobbes.
                 a PS2Linux demo only runs out of PS2Linux -- you can't burn
                 the executable to a CD-R and boot another PS2 with it. --jwang
2001/8/15-16 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers] UID:22133 Activity:moderate
8/15    Is there a way in C to specify that I want a particular enum type
        to be one byte or something small instead of the size of an int?
                typedef enum {ME_FOO, ME_BAR} my_enum_t;
                my_enum_t myVar;
                myVar = ME_FOO;
        I saw that gcc has an option "-fshort-enums", but I'm looking for a
        compiler-independent way, preferably in the source code itself.
        Another possible way is to do this instead
                unsigned char myVar;    /* It's really my_enum_t. */
                myVar = (unsigned char) ME_FOO;
        But that's ugly, plus "sizeof(my_enum_t)" is still the size of an int.
        Thanks in advance.  -- yuen
        \_ if you read your K&R you see that this is left implementation
           dependent.  You have to use a compile pragma, or just use the
           constants and not the enum type.  BTW I saw witort today. -- pld
           \_ Hi Paul!  I never noticed pld was you until you mentioned witort!
              -- yuen
        \_ There's no portable way to do this in ANSI C (C++ doesn't force
           a particular size either -- just a minimum size, AFAIK).
           The following hack might be your best option:
               enum my_enum_t_literals { ME_FOO, ME_BAR };
               typedef unsigned char my_enum_t;
               my_enum_t x; x = ME_FOO; /* Works, no warnings */
           sizeof (my_enum_t) is 1 in this case.  And the intent is
           clear from the naming convention.  -- misha.
           \_ i don't see anywhere in the standard that an enum CAN
              be converted to char. only int and larger (including float).
              i believe that implies that the compiler is free to
              issue a warning. but it would have to be a pretty
              stupid compiler.
              \_  Enum constants are the same as int constants (K&R2 A8.4),
                  and you can assign int to char in C.  Compilers might
                  give warnings if the value doesn't fit, which shouldn't
                  happen here.  C is liberal about primitive conversions,
                  which has some upsides (see Kahan's page about Java) -- misha.
2001/8/8 [Computer/SW/Compilers, Computer/SW/Languages/C_Cplusplus] UID:22046 Activity:high
8/7     Is there a way to assign values to a structure in one statement?  e.g.
                my_struct_t m1, m2;

                m2 = m1;        /* compiles*/
                m2 = {1,2,3};   /* doesn't compile */
        Thanks.
        \_ give my_struct_t a constructor.  pass 1,2,3 as arguments.
           m2 = my_struct_t(1,2,3);  --pld
           \_ if he's using C++, another way to do it is to define
              operator<< and/or operator,
              then you can do intuitive looking things like:
              Array ar;
              ar << 1,3,4,5,6;
              i don't remember the precedence of operator= but if it's
              lower than that of operator,
              you could also do
              ar = 1,2,3,4,5;
        \_ oh shit, you're asking for hell from the language lawyers.
           you can't do that at runtime but you can use that syntax as an
           initializer. that's why it's called "initializer" syntax.
           \_ Yes, you can say my_struct_t m2 = {1, 2, 3};
           \_ I need to assign different values multiple times, hence I can't
              do it as initialization.  Oh well, I'll just have to do it field
              by field then.
              \_ yeah, quit being such a lazy ass and do it by field.
              \_ have you read up on these things called "classes" by the way?
                 \_ Been out of school for too long.  I can't even find my K&R
                    book anymore.
                    \_ I have a copy, but it's in Russian :(.  As for your
                       question -- yeah, you can't use struct initialization
                       as assignment in C.  If you need it a lot, you can write
                       a macro.  -- misha.
              \_ this isn't terribly efficient, but can't you declare and
                 initialize a temporary structure, and then assign that to the
                 one you really want?  e.g.:
                 { my_struct temp = { x, y, z };
                   whatever = temp;
                 }
                  ...?  yeah, it's not a single line answer, but it's simple.
                 and if you're lucky, maybe your compiler will do the right
                 thing and ditch that temporary structure entirely. -jameslin
        \_ i think c99 allows this. you are using c99, right? -ali
2001/6/28-29 [Computer/SW/Compilers] UID:21669 Activity:very high
6/28    Is there an equivalent for Perl's '-c' option in javac?
        \_ JLint at http://www.ispras.ru/~knizhnik jikes -nowrite +B
           \_ jikes is the superior Java compiler
              \_ jikes is the STANDARD SUPERIOR JAVA COMPILER!
                 \_ JIKES!  JIKES!  JIKES is the STANDARD!  Superior Java
                    Compiler.
                    \_ jikes is as useful as Essence of Emerile while eating
                       a shit sandwich.
2001/6/18-19 [Computer/SW/Compilers, Computer/HW/CPU] UID:21569 Activity:nil
6/18    So GCC 3.0 is released.  Anyone know where I can find detailed info on
        the contents?
        \_ it doesn't build for mips-elf
           \_ I'm more interested in the detailed changes of the release
              (improved std C++ etc.).  And if I were to build it, it would be
              on win32.
        \_ http://gnu.org ?
           http://www.gnu.org/software/gcc/gcc-3.0/features.html
           \_ EVIL COMMIE LIBERALS. USE VISUAL C++.
2001/5/16-17 [Computer/SW/Compilers] UID:21286 Activity:low
5/15   anyone know how to produce a linker map file in vj++?
        \_ What exactly are you trying to do?
2001/5/12 [Computer/SW/Compilers, Computer/SW/Languages/Perl, Computer/SW/Editors/Vi] UID:21252 Activity:nil
5/11    http://www.grrl.com/hackerboy.html
2001/4/18 [Computer/SW/Compilers] UID:21014 Activity:nil
4/17    What is ld.config?  What is it used for?
        \_ It's a file used by some unix boxes to tell binaries and compilers
           where to look for object library files (.so and .a).  Man ldconfig.
           Considered by evil communists to be a bad thing.  -John
2001/4/16-17 [Computer/SW/Compilers] UID:20990 Activity:high
4/16    In a C statement like "if (foo > bar)" where foo is a int8 and
        bar is in32, how does the compiler translate that?  Does it turn
        it into a int32 to int32 comparison?  Or does it chop off bar and
        turn it into int8 to int8 comparison? If it does turn foo into an
        int32, where does it get the memory?  Compiler assign it a new
        register?  If so, is there a possibility that you run out of registers
        if you have lot of comparisons of different sizes?  Thanks.
        \_ 1. How a person writes a program has no bearing on how it will
           look like in the procedure stack. If a function is a leaf
           function and uses less registers than is actually available then
           there's no need for a new procedure stack. Where does it get the
           memory? The compiler figures this out.
           2. Yes, you can run out of registers. What's the solution?
           It's called register allocation.  There exists a myriad of
           algorithms to deal with this issue. Take 164 and you'll learn
           all about them. Not everything in a function fits in the register
              ints means "store in register and allow the automatic sign
              extension to happen". don't let the above comment make you
              think that int8<>int32 comparisons are somehow less efficient.
           file.
           \_ Uh, 164 with Savage Sue barely touched on register allocation.
        \_ C does type promotion.  In this case, foo will end up being a
           32-bit value that is the same, numerically, as the original
           8-bit value.
        \_ It creates a temporary int32 for the comparison.  The temporary
           value is normally stored in a register, but it will end up in
           memory instead if you run out of registers.
           \_ note that this doesn't mean shit in a modern architecture.
              your registers are 32 bits wide at least already, so that
              additional 24 bits are already wasted. type promotion of
              ints is actually a noop in a modern architecture: it's already
              stored as a sign extended 32 bit value. don't let the above
              comment make you think that int8<>int32 comparisons are somehow
              less efficient.
              \_ They are less efficient.  ALU operations don't automatically
                 sign extend 8-bit values in a register.  You need to do that
                 separately. For example, on a Sun:
                 foo.c
                 -----
                 int foo(char c, int i) { return c + i; }
                 int bar(int i1, int i2) { return i1 + i2; }
                 when you compile this with the -S option the two functions
                 are almost the same except:
                         stb     %o0, [%fp-17]
                         ldub    [%fp-17], %o0
                         sll     %o0, 24, %o1
                         sra     %o1, 24, %o0
                         ld      [%fp+72], %o1
                 used to perform the sign extension
                 \_ can you turn on -O  and rerun this, please?
                    \_ Similar results, though much shorter.  For both Sun
                       cc and gcc, foo produces a sll and sra by 24 but
                       not for bar. So yes, C promotion does incur overhead.
                       foo:
                       sll %o0, 24, %o0
                       sra %o0, 24, %o0
                       retl
                       add %o0, %o1, %o0
                       bar:
                       retl
                       add %o0, %o1, %o0
                       \_ i based my initial assertion on the fact that
                          many architectures provide a load byte instruction
                          which does sign extension on load to register.
2001/4/13 [Computer/SW/Languages/Java, Computer/SW/Compilers] UID:20960 Activity:very high
4/13    What's up with forward declarations and member function pointers in C++?
        I've got a bunch of classes that need to include each other, but when I
        try using a pointer to a member function (fooclass::bar) I get some
        bullshit about "incomplete type fooclass has no member named bar". Even
        though it does. So I can't get this bitch to compile. Am I just screwed?
        Happy Friday the 13th btw.
        \_ platform? compiler? a smaller sample that doesn't work?  From
           here is sounds like you're screwed.  I've done that web of
           class dependencies before with no problems.  -meyers
        \_ Yes, post your code in /tmp or something for others to view.
           \_ hmm. well i'm juggling other things right now so I'll try
              doing that later. this is g++ on linux by the way.
              i believe it would work if i change from calling class A's
              constructor in class B's constructor to setting it up manually,
              but that's not very elegant, and this is stuff other ppl will use.
                \_ Hand coding kludged solutions are known as "job security".
                   \_ yeah, especially if you're stupid and your coding-fu is
                      weak.
                   \_ leave him alone, he's probably only taken cs61b.
                      \_ Right, sorry.  I forgot about the "no-beating-
                         up-on-retarded-kids" rule on the motd.  mea culpa.
                         \_ When you're laid off and during the exit interview
                            your manager thanks you for writing such clear and
                            easy to modify code, you'll think back on this.
                            \_ Talking from experience, huh?  Poor guy.  Have
                               you ever considered a job in a less technical
                               field?
                                \_ You'll see.  It's easy to be 23 and think
                                   you're hot shit and the world is your
                                   oyster.
                            \_ not likely. People that do this sort of feeble
                               "job-security" crap get fired where I work.
                               Grow up and get a real job, kid.
                                \_ And the name of your New Age Enlightened
                                   company is...?
2001/3/15-16 [Computer/SW/Compilers] UID:20797 Activity:nil
3/14    Which of the following is better?
                #define intptr  (int*)
                typedef int * intptr;
        I think the latter is better, but why?
        \_ first, does #define intptr (int*) do what you want?  afaik,
           (int*) x is not a legal declaration.  if you get rid of the
           parentheses, consider the difference in the following if you use
           typedef or #define :
                intptr x, y;
           \_ Correct answer moved to the top.
        \_ The latter is better because the preprocessor will sometimes
        \_ what's wrong with just using int* ?
           \_ because it's not hungarian.
        \_ because CIVILIZED people don't succumb to those primal pointer
           urges, you sick monkey
        \_ Use void *, it is used but never used up.
        \_ first, does #define intptr (int*) do what you want?  afaik,
           (int*) x is not a legal declaration.  if you get rid of the
           parentheses, consider the difference in the following if you use
           typedef or #define :
                intptr x, y;
           substitute (int*) for intptr in bad places.  For example if you
           hook up two components that both define intptr with #define
           the preprocessor will silently choose one, whereas the compiler
           will complain about conflicting typedefs.
           \_ if you #define something twice, the preprocessor often will
              give you a warning.
        \_ #define's okay for smaller project. However, imagine you have
           constants (#define CONST1 12345) compiled into your objects and
           later on you change the semantics of your code. The compiler is
           certainly not going to catch your mistakes. Preprocessing sucks,
           save it for porting issues.
           \_ preprocessing when used properly can be quite useful.  Macros can
              sometimes do things that inline functions cannot.
        \_ The typedef is prefarable for the following reasons:
           (1) This is EXACTLY what typedef is defined to do.  Using
               #define is being unconventional.  Since there is no
               good reason to buck the convention you might as well
               follow it to make everyone's life easier.
               For example, somebody reading your code who sees intptr will
               probably assume it is a typedef (since that is the convention)
               and do things that might break if it was a #define.
           (2) Debuggers can figure out what intptr means if it is a typedef
               but not if it is a define.  For example, "p (intptr) x"
               should work properly in gdb with typedef not with #define.
           (3) Typedef is more likely to work properly in cases you haven't
               considered since the compiler has more information about
               what it's doing.  Consequently, it is more likely that
               compilers will generate proper warnings and error messages
               using typedef than with define.  Similiarly chaining typedefs
               will work, can you guarantee the same with defines?
2001/3/12-14 [Computer/SW/Languages/Java, Computer/SW/Compilers] UID:20753 Activity:high 71%like:20751
3/11    (define foo "there is a compiler that will take in java and ouput x86
        machine")
           \_ (what-is-it-called foo)
        \_ (url? foo)
           \_ (url-p foo), HEATHEN!
              \_ "define" is a Scheme special form, not Lisp.
                 \_ defun.  Lisp.  Kids these days.
                    \_ my other car is a cdr.
        |\_gcc does this. -ali
        |  \_ you mean gjc right? The code that is generated is quite poor
        |     and dumps core often.
        |     If you really want this M$ had a tool to do it in VJ++ and
                 \_ Yeah, gcj, I have having a dislexic moment.
        |     it worked pretty well. For non-M$ OSes SOL.
        \_____\_ i believe he means gcj: http://gcc.gnu.org/java/index.html
                 but gcj seems to be broken (can't even build helloworld.java)
                 - paolo
                 \_ Yeah, gcj, I was having a dislexic moment.
                dyslexic, you dysfunctionate _/
                 \_ Yeah, gcj, I was having a dyslexic moment.
                    I don't know about the current version, but at least two
                    versions last years *seemed* to be able to compile basic
                    stuff and run it. (At least that's what the guy in the cube
                    next to me said, I never tried it. Jikes + class file
                    obfusication worked well enough for me)
                        \_ obfuscation, you obsequious abstruse obstretrician
        \_ Doesn't TowerJ claim to do this?
           \_ We tried it about a year ago at work and it didn't work all
              that well. In most cases, the speed up was less than 1.5x,
              and the fastest the code ever ran was 2.2x. This was on x86
              Linux though. It might be better on M$ Lose*. But still, its
              not worth the money and time to retrofit everything to use
              towerj. You can get better speedups by avoiding exceptions and
              using java obfusication along with doing core pieces in native
              code. - not the original poster
              \_ This is not surprising, since well-coded java has regularly
                 run at very close to "regular" compiled C/C++.
                 The trick is in writing regular java in the first place.
                 But I want it for saving memory, in an ideal world.
        \_ IBM has a compiler that does this. I believe it comes with VAJava.
           I can find out references if you want.
           \_ sure

FIRST!
\_ Your strategerie confounds me.
        \_ my what now?
2001/3/12 [Computer/SW/Compilers] UID:20751 Activity:nil 71%like:20753
3/11    there is a compiler that will take in java and ouput x86 machine
        code - nameP
        \_ t
2001/2/27 [Computer/SW/Compilers] UID:20711 Activity:high
2/26    I assume GDB will allow me to do a trace on any core dump. correct?
        Is there a better way? (pedants:  if so what?)
        \_ I use gdb all the time to analyze core dumps. The problem is
           that gdb gives this facad of a horribly complicated debugger
           which scares people away.  You just need to start off with
           the basics. Compile and link everything with the -g option.
           That's all you need. you can invoke gdb from the shell or emacs
           by calling gdb a.out core (substitute a.out with your program).
           bt is you best friend for finding where a program crashes.
           You're on your own from there. It's sad, I'm not even a
           software engineer and I use debuggers more often than most of
           them do.
                \_ I use Java.  I don't need to debug.  My programs are
                   guaranteed bug-free by Sun.
        \_ i can't think of anything better than what gdb+emacs does.
           what feature do you need? -ali
2001/2/7-9 [Computer/SW/Compilers, Computer/SW/RevisionControl, Computer/SW/OS/Windows] UID:20531 Activity:high
2/7     Any recommendations for Windoze NT/2000 backup software,
        where each user keeps their files on local disk?
        \_ Windoze is not recommended.
        \_ Yech.... Legato I guess but why would you let users keep local
           files?  Your issue isn't backup software.  It's the way you run
           your system.
           \_ What strategory would you suggest?
           \_ What strategory would you suggest?  Obviously I can force
              everyone to compile files on a shared file system, but
              this would make our programmers feel corporate and they
              wouldn't like that.
                \_ They can compile anything on anything they like but I
                   suggest either: store source on remote disk and set up
                   compiler to write all objects, etc, locally or much better
                   would be to use a revision control system like perforce
                   or others that have been discussed previously on the motd
                   and just backup the perforce server.  Anyone stupid enough
                   to never checkin their code deserves to get fucked.
                   \_ Wrong.  source control systems are meant to store
                      revisions, not to be used as primary backup systems.
                        \_ Duh, I didn't say it was a backup system.  I said
                           you're backing up your revision control system
                           instead of dozens, hundreds, or however many desk
                           tops.  Try reading before posting.  Thank you for
                           playing "sysadmin for a day".  Come back next year.
                           I wouldn't want to be the guy to answer to the VP
                           of Engineering when he asks why half his code base
                           went poof and you can't restore it.  "It's a
                           revision control system, not a backup system, so I
                           didn't back it up".  That makes no sense.
                           \_ Read my post again, hacker.  I said they should
                              not be the PRIMARY backup.  They are secondary
                              to having a PRIMARY backup of people's local
                              files.  What you suggest is the easy way out.
                                \_ What I suggest makes it more likely the
                                   files will get backed up even when people
                                   turn off their machines at night.
2001/1/25-27 [Uncategorized/Profanity, Computer/SW/Compilers] UID:20435 Activity:very high
1/25    Which is a more efficient strcpy()?  Is it copying each character
        until you reach \0; or is it calling strlen() to get the length
        of the string and executing a memcpy of that length?
        \_ That probably depends on the CPU architecture, e.g. whether or not
           it has string instructions and how efficient they are.
           \_ Assume Pentium 3 with a Linux 2.x kernel and using gcc 2.95.2.
              \_ with strlen() counting each character until \0 is found.  :-)
                 \_ why?
                    \_ Relax, son, it's a joke.  Move along.
        \_ wc `locate strcpy.c bcopy.c`
        50     337    2163 /usr/src/lib/libc/string/strcpy.c
        47     328    2085 /usr/src/sys/libkern/strcpy.c
        35     112     711 /usr/src/contrib/binutils/libiberty/bcopy.c
       139     685    4175 /usr/src/lib/libc/string/bcopy.c
       271    1462    9134 total

            #include <string.h>

            char *
            strcpy(to, from)
                    register char *to;
                    register const char *from;
            {
                    char *save = to;

                    for (; (*to = *from) != 0; ++from, ++to);
                    \_ != 0 not needed
                    return(save);
            }
                \_ Now do it in 6052, 80286, perl 4.036 (1 line or less),
                   and 3 other languages/scripts of your choice.
                   \_ by "6052" do you mean 6502?  fucking hoszer.
                        \_ Holy shit!  A typo!  And you caught it!  Wow!
                           You are *soooo* smart!  Did you tell yermom?
                           I'd bag on _your_ typo but I'm not as smart as you.
                           \_ I'd bag on your misspelling too fag.
                              \_ Uhm, there wasn't one, son....  Either way,
                                 if the best you can do is toss around "fag"
                                 one liners, maybe you're better off just not
                                 bothering.  Maybe you should try again in a
                                 few years when you're passed your 6th grade
                                 tests.
                                 \_ Suck my dick, cocksucker.
        \_ gcc has a built-in implementation of strcpy, but i can't get it
           to emit on linux, gcc 2.95.2. anyone have better results? -ali
           \_ Try compiling with -Dstrcpy=__builtin_strcpy. The -fhosted or
              -fbuiltin options sound like they should work, but they
              don't. -asaddi
2001/1/19-21 [Computer/SW/Compilers] UID:20380 Activity:nil
1/19    First C compiler uncovered:
        http://www.theregister.co.uk/content/4/16227.html
2001/1/15-16 [Computer/SW/Compilers] UID:20327 Activity:high
1/15    Stanfurd offers "Programming Language CS242" in conjunction with
        CS243, their version of Berkeley's Advanced Compiler 264. How come
        Berkeley doesn't have a Stanfurd equivalent of CS242?
        \_ Look up the actual curricula for 263 and 264. Also look up "proper
           use of plurals in Ennglish"
           use of plurals in English"
           \_ you must be some queen's english throwback.
           \_ But there is only the *one* programming language, and there is
              only the *one* advanced compiler. -troll
2001/1/12-15 [Computer/SW/Compilers] UID:20307 Activity:insanely high
1/12    Is it a property of the new compiler that it creates a local name
        __func__ in every frame, at least when debug info is generated,
        where the value of that local is the function name?  I just noticed
        that this is the case, but I'm not sure when it started happening.
        \_ [moved idiot who stuck comment in the middle]
                \_ What new compiler?  "the new compiler"
                   doesn't make any sense without context.
                   \_ [ it has context.  the context is right fucking there on
                       the screen.  maybe you're from the post-mtv generation
                       that can't recall the point of a paragraph 2 sentences
                       later. stop sticking comments in the middle or get
                       purged again.   the rest of us aren't as dumb as you]
                        \_ I see no where that it says what the "new compiler"
                           is.  It could be gcc 2.96, javac 1.3, MSVC whatever,
                           or someone who just discovered a compiler the rest
                           of the world has been using for years.  Pull your
                           head out of your ass nimrod.
                           \_ Dumbshit, try basic English.  Your comment was
                              fine.  You put your comment in the wrong fucking
                              place.
                              \_ Lay off the drugs.
                                 \_ Remember to take your drugs.
                                 \_ My dosage level is just fine.  Saw my
                                    therapist only two days ago.
        \_ I believe this is a requirement of the new ISO standard C99.
           --Galen
           \_ c99 describes how to produce debugging symbols???
              \_ <DEAD>web.onetelnet.ch/~twolf/tw/c/c9x_changes.html<DEAD>
                 \_ freaky things on that web page:
                 11. [introduction of] _Complex, _Imaginary, _Bool.

                 14. Array declarations may have a '*' between the square
                     brackets (used for variable arrays in parameter lists).
                 16. compound literals: create and init anonymous structs and
                     arrays.
                 23. the above mentioned __func__: it can actually be used
                     as a variable in your code to get the name of your
                     function
                 33. There are variable-length arrays, whose size depends not up\
on a constant expression but on a computed value. Variable-length arrays must no\
t be global or members of a struct or union. Multi-dimensional variable-length a\
rrays are allowed. (this rules because people were weary of using this feature
                 in gcc. now it's standard)
2001/1/11 [Computer/SW/Compilers] UID:20293 Activity:nil
1/9     Why can't somebody make a java compiler that generates machine
        code?  Screw the cross platform bytecode, then it'd be just as
        fast as C/C++ and would still be the more cleanly-designed
        language.
        \_ They have.  It's called gcj, and it's part of the Gnu Compiler
           Collection, normally referred to as gcc.  -mogul
                \_ TowerJ is much better.
2000/12/26-28 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers] UID:20177 Activity:high
12/26   Does any one have any suggestions for debugging programs?
        \_ try /csua/bin/clue
          \_ printf is your friend!
        \_ are you looking for debugging strategies or debuggers?
        \_ If you are looking for debugging strategies, I would recommend
           sprinkling assertion checks throughout your program.  For example,
           if you have a data structure, write a function to check that the
           internals of the data structure are consistent.  Then use the
           assert macro (man assert for details) to verify that the
           data structure is consistent when you modify it.  You can also
           use assertions to check that the inputs and outputs of your
           functions satisfy your assumptions about what they should be.
           Assertion checks are one of the best tools for finding bugs.
           \_ aka: printf.
            \_ Yes. Because we want to run helper debugging functions for
               every little data structure we use.  That's much easier
               than using the gdb print command.
              \_ print(3) doesn't call sigabrt for you.
        \_ if your data structures are weird, try DDD (gui wrapper on GDB)
        \_ on a somewhat related topic: whenever I try to use lint, it
           complains that it can't find llib-lc.ln.  How do I fix this?
                \_ Install the lint libraries package(s) for your OS.
           \_ you don't use lint. you use gcc -Wall -O3 (turn on optimization
              for data flow)
2000/12/17 [Computer/SW/Compilers, Computer/Theory] UID:20114 Activity:high
12/14   I totally don't see any relevance in teaching Lambda calculus in an
        undergrad course to describe stupid semantic rules. Fuck Aiken and
        his stupid ambiguous exams!!!
              researcher)
           \_ usually to emphasize its distinction from an algebra.  keep
              in mind that "the calculus" taught in high school is
              really "the calculus of infinitesimals."
        \_ this is a simple question but: why do they call Lambda calculus
                "calculus"?
           \_ It's a way of calculating stuff. and it sounds cool (to a
              researcher)
           \_ usually to emphasize its distinction from an algebra.  keep
              in mind that "the calculus" taught in high school is
              really "the calculus of infinitesimals."
        \_ I actually wish Hilfinger covered some of that stuff.
           \_ Hellfinger just asked you completely unrelated questions
              pertaining to English lit or what happened on a certain
              date in France that never existed. Often times those
              answers were as simple as zero or nothing. Nevertheless,
              I enjoyed pushing the very limits of my parasympathetic
              nervous system.
                \_ About dates that never existed?  Then the answer is pretty
                   obvious: nothing.
                \_ Has a Hellfinger exam question list been compiled?
                   I know two: one about some british poem and another
                   about some Spanish/Mexican revolutionary figure.
                   And i think it was french lit and english date.
                   \_ "someone" should definately do this... I remember two:
                      what was the HMS Java? I don't remember the answer
                      but can look it up. The other was a line from "Ode on
                      a Grecian Ern". If more people post them, I can
                      compile the list.
                   \_ this is a good idea.  A question from one of my exams was
                      "Where do the poppies blow, between the crosses, row on
                      row?" (A: In Flanders Field)
        \_ If you're going to teach language semantics,
           at all, there are two ways to do it.  (a) Operational
           semantics, in which your language description is written
           in something that works like Tcl.  This is icky and went
           out of vogue in the 70s.  (b) Denotational semantics,
           in which your language description is written in something
           that works like Scheme (the Lambda calculus).  Thank
           God that your undergrad compiler class is not about stupid
           shit like how to write a lexical analyzer, like mine was.
           Also, http://m-w.com's definition of "calculus":

                 1 a : a method of computation or calculation in
                 a special notation (as of logic or symbolic logic)

           If semantic rules are stupid, then what exactly is a
           programming language?                      -blojo
           \_ Programming languages are hard.  Let's go shopping!
        \_ lexical analyzers are not "stupid shit".
           especially the practical applications of 172 stuff.
           and neither are lambda calculus or type systems.
           how can you justify asserting that they are? this whole
           thread is just bizarre.
           \_ well, they're kind of over-kill in general when all
              you really need is an s-expr reader.
              \_ How quaint; how '50s. Dude, humans were not made to
                 read s-expressions.
                 \_ I wasn't made.  I was born.  -human
           \_ A lexical analyzer is a necessary component of a compiler
              and it's worth maybe spending a week talking about them.
              It is NOT worth spending 1/3 to 1/2 a semester talking
              about them and doing major projects regarding them.
              Any programmer with a clue can write a lexical analyzer.
              It just takes general programming knowledge.  The important
              knowledge in compilers, the domain-specific stuff that the
              class should be spent teaching, is all about semantic
              analysis, code motion, and maybe provability.   -blojo
              \_ Um.  I can write a lexer very quickly with automated tools
                 like Lex.  Very quickly == hours, not days.
                 \_ Yeah, that's like my point, see.  -blojo
              \_ lexical analysers are good for building language -> machine
                 translators, but the underlying theory is useful as a basic
                 model of computation. knowing all the DFA, NFA, REGEXP
                 equivalence shit is really useful if you do CS.
                 also, there is a lot of theory that goes behind building
                 YACC. you could either use YACC as a customer (as in the
                 way compiler writers do) or you could delve into the theory,
                 like the way language people do. i think you're a lazy
                 bitch if you think this shit is bunk. -ali
                 \_ Bunk!  Bunk!
2000/12/12-14 [Computer/SW/Compilers, Industry/Startup] UID:20082 Activity:moderate
12/12   This may sound wierd but is there a way for a program compiled
        with the -g debugging option to examine its own stack frame?
        I once ran a program that, whenever it crashed, did an automatic
        backtrace on itself and dumped it to stderr.
        \_ ~mconst/src/gdbcall will let your program run gdb commands
           (like "backtrace") on itself.  --mconst
        \_ another toy, that helped destroy, the elder race of man.
        \_ You can do this in assembly, catch an exception and simply
           check your stack register and walk all the way up
        \_ How about catching SIGBUS, dumping core and then running gdb
           backtrace on the resulting core file.
2000/12/9 [Computer/SW/Languages/Java, Computer/SW/Compilers] UID:20050 Activity:nil
12/7    Eh, why are some virtuals set to 0 (pure virtual) and some are not?
        \_ defining as virtual = 0  to create an interface definition or
        abstract class
           \_ Yes.  In particular, pure virtual functions are a signal to both
              the compiler and client code that this class is not expected
              to be instantiated, only inherited from.  It also requires any
              child classes to provide the method, but doesn't provide a
              default implementation.  There are many situations where this
              is exactly what you want.  You may not really get this until
              you're trying to make a framework of code that other people
              are expected to use, but not modify... -mogul
2000/12/4-5 [Computer/SW/Compilers] UID:19992 Activity:low
12/3    Are there production C++ compilers that'll analyze the control flow
        on pure virtual functions to optimize the overhead of polymorphism
        calls?
        \_ Yes.
        \_ ugh, flow? pure virtual? Poly what? !??!??!?
                \_ Poly want a cracker!
2000/11/28-30 [Computer/SW/Compilers] UID:19936 Activity:moderate
11/28   On an HP-UX system, how do I make a shared library?  I tried the
        procedure I normally use with other systems, but it fails.  Here's
        what happens:

        gcc -c -fPIC a.c
        [no errors]
        gcc -shared -o a.so a.o

        And I get this error message:
        /usr/ccs/bin/ld: DP relative code in file /var/tmp/ccmAcwPp.o - shared
        library must be position independent.  Use +z or +Z to recompile.
        collect2: ld returned 1 exit status

        Neither +z nor +Z appear to be options for gcc though.
        \_ gcc has always had broken so support for hpux. you may either need
           to upgrade or give up (read the release notes for gcc to find out
           which). you might have better luck with -fpic instead of -fPIC. -ali
        \_ Check how your gcc was built. The *.a files there (libg2c.a,
           libstdc++.a, libgcc.a etc.) probably have position dependent
           code in them. --dim
           \_ libc has nothingto do with making a .so. there is no check for
              libc inthis step.
        \_ Not sure if this is what you're asking for, but try:
                ar -q library.a objectfile.o
           \_ (S)he said shared
           \_ *
        \_ On a platform I don't know, I usually snag some random library
           (say gnu readline) and run ./configure on it, then read the Makefile
           (or just run make and see what the shlib link line looks like)
           \_ *
        \_ those branded with * are morons
           \_ *
              \_ *
2000/11/28-29 [Computer/SW/Languages/Java, Computer/SW/Compilers] UID:19928 Activity:high
11/27   Fuck Aiken, COOL, and semantic analysis!!!
        \_ Don't you mean "Fuck'ken COOL, semantic analysis!!!"?
        \_ Sorry to say but its your fault for taking it with him and
           not with Hilfinger and Java... that's what I did and the
           class ruled.
           \_ Frankly, "wrote a java compiler" looks infinitely better on
              a resume than "wrote a COOL compiler".
              \_ And you're only doing this major because it looks good on the
                 resume right?
                 \_ And you're not?  You bought in BH's whole thing about the
                 \_ And you're not?  You bought into BH's whole thing about the
                    intrinsic value of education for it's own sake and blah,
                    blah, blah?  The rest of us have bills to pay.
                 \_ If you're hiring java engineers, would you rather hire
                    someone who implemented a "java" compiler or a "COOL"
                    compiler?  Gotta take this class anyway, might as well
                    get the best buck for it.
        \_ Yeah, there were so many cases to cover with semantic
           analysis.  Ridiculous for a class project.
           \_ It was 10x worse with Hilfinger, so shut the fuck up.
                \_ But think about how much more you learned!  You don't need
                   a high GPA, just a sense of personal satisfaction!
                   \_ I did. And I got an A in the class. I wasn't complaining,
                      it wasn't that bad if you put in your 100 hours...
                      I was just noting that it was way more work than Aiken's
                      lame projects. Now Graham, that's a killer.
        \_ Life would be a lot easier if you figured out HOW to deal with
           all of the cases and ambiguity BEFORE writing any code.
        \_ Try Graham.
         \_ was I the only person who liked Graham? -aspo
            \_ yes.
            \_ In a biblical sense?
2000/10/26-27 [Computer/SW/Unix, Computer/SW/Compilers] UID:19572 Activity:nil
10/25   I'm looking at some source code (bootp.c) and I see reference to
        MACPY (...). I can't find the define anywhere in /usr/include/*
        Anyone know what this does, where a definition exists?
        \_ use grep -R
        \_ man MACPY
           \_ No manual entry for MACPY
        \_ gcc -E
        \_ (exuberant-)ctags -R --Galen
2000/10/12-13 [Computer/SW/Compilers] UID:19465 Activity:insanely high
10/12   OK, quick poll to see how many motd-readin' CSUAers were warez
        kiddies at one point (Ever call a ware 0-day? Ever ask for elyt xs?
        Or ever use leech zmodem? Don't be embarassed, you were 12!):
        Yes ....
        No  .
        \_ Does using your Apple][ to dial numbers to get free long distance
           count? If so, count me in.
        \_ Back when I was a kid, software was free or we had to write it
           ourselves.
           \_ Using ThinkC/TurboPascal on a MacSE.
              \_ For me, using (floating-point) BASIC and machine code on
                 Apple ][+.  -- yuen
                    \_ Actually my first computer was a TI 99/4A. I wrote
                       programs on it in basic and saved them to audio
                       tape. I used to be able to skip to exact programs
                       on a 45 min tape by listening to the sound made
                       when fast forwarding (it changes pitch as it gets
                       closer to the end of the tap). Those were the days.
                       The first computer that I had with a compiler was
                       the Mac SE. Damn it was a nice machine. Ran word,
                       pagemaker, photoshop and compilers with a 68000
                       and 1 MB Ram (eventually upgrade to a whopping 4).
                 \_ goddamn it, thats when programming was programming.
                    programs on modern computers may do more, but there
                    was a satisfaction in entering a whole program in
                    hex and having the thing work that can never be
                    matched with a compiler. -apple ][e haX0r
                    \_ Toggling in the entire OS on the front panel
                       of the computer a la Seymour Cray is *satisfaction*.
        \_ yup, used zmodem.
             \_ hmodem with simultaneous up/download with 4k chunks on
                my 14.4 when everyone else is crawling at 2400...
             \_ Used zmodem too, but not for warez.
           \_ super zmodem with simultaneous tetris and hot/gay chat
           \_ Using softICE to crack your momma's pussy.
                                     \_ don't you mean yermom
                                        \_ or yo mama
              \_ dewd, you must be the 700th person to get in there
        \_ I'm sure that lots of us were warez h0zers.  I was, back in HS.
           Still, that was a long time ago... the whole scene is very
           different now.
2000/10/10 [Computer/SW/Languages/Java, Computer/SW/Compilers] UID:19454 Activity:nil
10/9   from: http://www.OCF.Berkeley.EDU/~summerm/keepOut/resume.html

CS 188: Creating Intelligent Agents That Could Get a Better Grade in this Class
        Than You Will
CS 174: How to Win at Blackjack Even if You Left Your Towel in Your Motel Room
CS 170: How to Do Just About Anything if You Have a Computer the Size of a
        Small Planet (or the Most Advanced Graphics Calculator on the Market)
CS 164: Writing Compilers That Can Change Your Grade for You (note: everyone
        who finished the project got an A in the class)
Math 241: Derivating W.R.T. Inspector Gadget, If You Please
Math 55: You. Me. Gauss. The connection.
Math 54: The Cauchy-Schwarz Inequality Applied to Non-Euclidean Vectorspaces.
Peace and Conflict Studies 222:
         The Lighter Side of Overpopulation, Famine, Ecological Disaster, Ethnic
         Hatred, Plague, and Poverty
Political Science 2: Political Diary, An Episode by Episode Account
2000/10/6 [Computer/SW/Compilers] UID:19425 Activity:nil
10/5    phale the compiler god, are you REALLY that good w/164? Did you
        take 264? What do you think about 264?
        \_  First off, I'm not a god (although perhaps a minor diety).  I took
            264, and I'd say that 264 wasn't very useful for the most part.
            Although it probably depends on who teaches it.  Lately, I am
            finding compilers really boring.  But then again, in my current
            work I am forced to use the piece of shit VC++.
2000/10/5-6 [Computer/SW/Compilers] UID:19421 Activity:very high
10/5    How do you know whether you're going to ace CS164 or barely going
        to pass it? I kick ass in flex and regular expression, but I'm
        having a little problem with this LL LR LALR theory. Help.
        \_ I hate compilers and I didn't understand half of the material, but
           for some reason the prof gave me an A+.  So being good/bad at the
           subject doesn't always mean you'll get a good/bad grade.
        \_ regular expressions is just a small part.  But I wouldn't worry
           about LL, LR, LALR too much as you should have plenty of time to
           digest it.  And afterwards, the course takes a completely different
           direction and becomes annoying anyway.
           direction and becomes annoying anyway. -phale
           \_ hey bitch, I liked cs164.  Back off you little shit. -aspo
              \_ hey slut, I liked 164 as well.  Even TA'd for it.  But just
                 because I liked it doesn't mean I'm going to sugar-coat my
                 answer.  -phale
                 \_ bitch, after the LL, LR, LALR stuff is when it got
                    interesting
                    \_ Yeah!  bitch!
2000/10/3-4 [Computer/SW/Compilers] UID:19397 Activity:high
10/02   What's a good supplemental reading for the oh-so-boring
        Compilers, Principles, Techniques, and Tools, by Aho? I'm looking
        for a Compilers for Dummies equivalence.
        \_ "Compiling With Continuations", Andrew Appel.  -blojo
        \_ Compilers aren't for dummies.
           \_ Computers are for dummies, duh.  That's thhe whole point of
              the web, ebusiness, etc.
        \_ My girlfriend is using Programming Language Pragmatics by
           Michael L. Scott.  I flipped through it.  It seems much better
           than Aho.  It's not for dummies though.  Good reviews on Amazon
           too, if that means anything.
                \_ Thanks! Now I'm going to ace CS164!!!!!
                   BTW What's your gf's name?
                   \_ She is not in Berkeley, unfortunately.  Otherwise, I
                      would be more than happy to introduce her to you.
                \_ If you want to ace CS164, just date your TA.
           \_ Cool, a whole new series concept: "programming for girlfriends".
              \_ Instead of buying a Dummies book you could buy a Girlfriends
                 book. Wow!
                 \_ Don't laugh.  I regretted the day when I robbed the
                    cradle and got myself a pretty but nerdy cs student
                    girlfriend.  Don't do it if you don't want to go
                    through the whole darn CS curriculum all over again,
                    starting from implementing a string class.  Feels like
                    going through hell a second time.  Luckily, I have
                    finally reached the stage of helping her revise her
                    resume and graduate school statement.
                    \_ I'm not sure whether to laugh or cry.
                       \_ I'm sure. I wnt to cry. How can *I* pick up a
                          cute female CS student that is smart enough
                          to actually graduate?
                    \_ WTF, I had to help my boyfriend through his undergrad
                       career, and when I TA'ed 164, the guys were just as
                       clueless as the girls.  In fact, due to the overall
                       M/F ratio, there are a lot more morons than moronettes.
                       Sounds to me like your girlfriend is trying hard
                       to feed your large ego to compensate for your small
                       penis.  Sign your posts you idiots, I'm going to teach
                       your girlfriend the secret 164 death grip.   -- alice
        \_ Use motd for serious + helpful info please. Humor is
           not allowed.                                 -tom
           \_ Hahaha!
           \_ tom doesn't use that many spaces.  I also don't think he
              uses '+' like that.
2000/9/27 [Computer/SW/Compilers] UID:19345 Activity:nil
9/26    What's a good alternative, Cliff Notes like substitute to Aho, Sethi,
        and Ullman's dry and *yawn* boring Compilers: Principles, Techniques,
        and Tools?                              -desperate failing junior
2000/8/18-21 [Computer/SW/Compilers] UID:19030 Activity:low
8/17    Book review of the week: Linkers & Loaders, by John R. Levine.
        The beauty of Levine's writing is the carefully crafted gorgeous run
        on sentences (amazing in their delicacy of technical word choices)
        contrasted with the gcc that spurts from his finely developed
        compilers. After the first chapter I was hooked and wanted to read
        more. Levine, without a doubt, is one of the best technical writers
        of any technical genre.
        \_ Levine seems pretty smart. (He also moderates http://comp.compilers.)
           -brg
           \_ Did Miss May 2000 give him oral sex, however? -yerpal-tjb
           \_ does he make more money than hot shot developers & sys adms?
2000/8/9-10 [Computer/SW/Compilers] UID:18930 Activity:high
8/8     When I compile C++ with dynamic dispatch, will the actual generated
        code (assembly) contain a lot of if-else check for each method
        call? How about Java? Is the compiler smart enough to do flow
        analysis and do type checking to narrow down types, thus speeding
        up the method call?
                \_ This sounds like one of the weenies 6-8 years ago who
                   always loathed the use of "virtual" in C++, afraid of what
                   the cost of a couple of table lookups would do to their
                   overhead.
        \_ It uses a function dispatch table.  Very efficient.
        \_ If you are smart enough to worry about whether your compiler
           does flow analysis, you should be smart enough to research your
           vague assumptions.  Check out _The C++ Object Model_, Stroustrup
        \_ Yes, Java and C++ use runtime dispatching, which adds around 1-5
           cycles of overhead per function call (for commonly executed
           routines, where the function table is in cache) and 10+ cycles
           (for infrequently executed ones, or where you're just executing
           lots of functions or somehow else thrashing cache). If you're
           invoking lots of small methods (which is how these
           languages are typically used), that can be a huge loss of
           performance. THere has been recent work on, e.g. dynamic
           compilation to specialize away the function table lookup. Can't
           recall the authors off the top of my head. -nick
        \_ Sun HotSpot (and presumbly IBM/Tower equivalents) easily inline
        and compile virtual calls at runtime. At least with Sun's, you are
        back to very small methods because the compilation of a method is
        triggered simply after several thousands iterations are counted -
        if you inline everything into one flat main() or run(), it'll never
        get compiled but you'll pay dearly for all the profiling. You won't
        hear this from Sun.             -muchandr
2000/8/4-6 [Computer/SW/Languages, Computer/SW/Compilers] UID:18887 Activity:moderate
8/5-1   Why is unstructured code (e.g. goto, jump, etc) hard to optimize?
        Isn't control flow implicit anyway? Also, is it difficult to make
        a transformation from unstructured code to a structured code? For
        example, from byte code or a binary back to a structured intermediate
        representation?
        \_ GOTO LOOP_START:
        \_ gotos aren't evil if they are just a low-level analog to structured
           control flow (e.g. gotos can be used to implement a FOR loop).
           Gotos are evil when they are used to create what is known as
           "irreducible control flow", which essentially means that there
           is no 1-1 correspondence between gotos and FOR loops. E.g. a goto
           can enter a loop in the middle! It ends up that early exit
           loops aren't as bad as entering in the middle. Irreducible
           control flow makes many syntactic analysis algorithms barf, cause
           those algorithms assume reducibility. -nick
                \_ which nick are you? Mitchell? Kevin Mitchell's brother?
           \_ concretely, compilers will reorder instructions and make lots
              assumptions about what register contains what at what point.
              if there are many points of entry to some piece of code, there
              will exist many possible initial states for that piece of code,
              and you end up with ltos of dependencies. -ali.
        \_ Don't loop then. Write everything data-directed. -muchandr
            \_ go APL!!!!!!!! -nick (yes, mitchell)
                \_ nick mitchell, you a phd candidate? what's your area?
                   \_ yes, nick mitchell is a phd candidate, compilers
            \_ data directed is much more difficult to optimize
        \_ APL kicked ass. It depends what you are trying to optimize I
        suppose. Data directed code is much easier to parallelize for instance
        and in specific case of vector languages like APL you easily do
        allocate lots of memory statically for some of those cases they are
        making fancy garbage collectors that never work as advertised today.
                -muchandr
2000/8/4-5 [Industry/Jobs, Computer/SW/Compilers] UID:18878 Activity:moderate
8/5-1   When people talk about flex dollars (for insurance and stuff)
        they always say to use it or lose it.  What does this mean?
        I thought you could always elect to have the leftover money
        go towards your salary or 401(k) contributions.
        \_ Then you weren't paying attention, were you?
        \_ I get leftover monies in a lump-sum around mid-year.
           You can look at this as them "secretly" giving you a higher
           salary, and having to pay for your own benefits. (tax-
           advantaged, and at group rates)
        \_ Most places if you don't use the leftover money it goes to the
           company doing the flex plan.  However, most places also let
           you spend money you haven't put in yet (at least for medical)
           so it's possible to spend money you haven't put in,
           leave the company, and not have to pay it.
2000/7/19 [Computer/SW/Compilers, Computer/SW/Unix] UID:18722 Activity:high
7/19    I wrote a parser that outputs C source code.  If I run the parser
        on windoze I get CRLFs.  If I run it on UNIX I get LFs.  How
        can I get the parser, running in windoze, to just output LFs
        with a minimum of headache?  The parser is itself written in C.
        \_ man gcc
        \_ Replace \n with \012 in string/char literals; most C compilers
           will leave \012 alone even on a CRLF platform, but I can't vouch
           for M$. If you have CRLF's being output without being in a
           literal, your best bet is probably tr'ing the output
           \_ Duh. Thanks.
2000/7/11-12 [Computer/SW/Compilers] UID:18641 Activity:very high
7/11    What's a good formal measure of how well a distribution is approximated
        by a normal of the same mean and variance?
        \_ least squares?
        \_ Uh, the third moment, for starters.
           \_ How valid is this as a statistical measurement? I.e. if
              distr. A's skew is higher than distr. B's skew, is A expected
              to deviate from normal more than B on other parameters as well?
              \_ to see how bad this measure is, consider the distribution
                 delta(x) (which is infinity at 0 and 0 everywhere else)
                 and N(0,100) which is a zero mean gaussian with variance
                 100. the former is the narrowest distribution you'll find,
                 the former is very wide. yet their third moments are both 0.
                 a very bad measure indeed. in fact, all 0 mean even functions
                 have the same odd moments. -ali
                        \_ Life was much more pleasurable back in the old
                           days, when all I needed to go smack Rahimi's
                           pompous ass is going upstairs :) -muchandr
                 \_ This isn't applicable since I'm fixing the variance as
                    well. Of course the n+1'th moment is relatively useless
                    if the n'th moments are way off.
                    \_ the point is that if you have an even symmetric
                       zero mean distribution, the third moment will be
                       0, even if your second moments matches. You really
                       need to look at all moments to test for equality.
                       You should really look at mutual information (what
                       emin suggests) if don't have an application in mind
                       and just want a similarity measure with nice properties.
                       \_ noted, thx
        \_ You could also look at the Kullback-Leibler distance which is
           also known as relative entropy.  This has some nice properties.
           For example, if you build a Huffman code for distribution p
           and use it to compress a source with distribution q, the
           expected overhead for using the wrong distribution is D(p||q)
           where D(p||q) is relative entropy.  I don't remember the details
           but I think that D(p||q) also comes up if you are doing
           hypothesis testing where the true distribution is p but you
           think the distribution is q.  If you tell us what application
           you want a difference measure, we might be able to give better
           suggestions.  P.S., you could also using p-norms where
           p = 1,2, or infinity. -emin
           \_ I'm trying to do an approximate analysis of a hideously
              intractable numeric process, and this distribution, which
              is (graphically) "somewhat" normal looking is about half-way
              inside the bigger picture; since it's a sum over a bunch of
              binomial coefficients, I was advised to assume normality
              asymptotically to simplify things, but I want some way of
              getting a feel for how off I am. Yes, generic and not
              well-defined, but you really don't want to hear the gnarly
              details.
              \_ I'm not sure what you mean when you say "it's a sum over
                 a bunch of binomial coeffcients".  However, if you are
                 interested in the random variable S_n = (1/n)*sum(1,n) X_i
                 then the cdf of S_n will converge to a normal distribution
                 with a convergance rate roughly 1/sqrt(n) provided that
                 the random variables X_i are reasonably well behaved.
                 Lookup Central Limit Theorems for the details. -emin
                 \_ Noted; although I have some doubts about the "reasonably
                    well-behaved" part
        \_ one way to do stats is to always optimize the expected value of
           some cost function, and depending on what that cost function is,
           you pick the correct prbabilistic entity to be extremised (for
           example, likelihood or entropy, or some other function).  i think
           the sensible way to answer your question is "what is the cost
           you incur from using the wrong distribution" in terms of the cost

           function you're trying to maximize. i would say mutual information
           is a nice hint, but you really need to watch out for what you
           use the distribution for. -ali
           \_ see above; what i'm looking for to start with is the cost
              function, and it's painfully intractable, both mathematically
              and computationally
              \_ it seems to be that you're saying you can't even SAMPLE from
                 p(x) where p is the correct distrib? if you can sample from
                 the dist, you can do what i'm suggesting.
                 \_ Dude.  If you can sample independently from the
                    distribution, the distribution is your bitch.  You need
                    about twelve samples to approximate it to the degree that
                    is generally needed (source: McKay).
                 \_ The problem is that I'm looking for asymptotic behaviour,
                    and while I can sample at my test sizes at the rate
                    of 5-20 hours per sample, sampling at any decent size
                    can take years per sample
           \_ Aren't you in compilers ali?  Stop studying AI!
        \_ The Kolmogorov-Smirnov test might be useful as well -- used for
           testing if two data sets come from the same parent
           distribution, or whether a data set is consistent with a
           predicted distribution.
           \_ noted, thx
2000/6/30-7/1 [Computer/SW/Compilers] UID:18572 Activity:nil
6/30    anybody know where I can find documentation on linker scripts? I
        have a .link file with stuff like:
        .sbss . : {
                __bss_start = .;
                _fbss = .;
                *(.sbss) *(.scommon)
                . = ALIGN(32);
        I have no idea what these things do.  The manpages for ld doesn't
        tell me anything either.  Thanks.
        \_ <DEAD>sourceware.cygnus.com/binutils/docs-2.10/ld_3.html<DEAD>
           You should be able to find the same information by running
           "info ld", but the info pages are harder to read than HTML
           and aren't installed properly on many systems anyway.
2000/6/2 [Computer/SW/Compilers] UID:18389 Activity:moderate
6/1     Is g++ (gcc) installed anywhere other than /usr/bin/g++?  Any newer
        version than 2.7.2.1?  (locate didn't help)
        \_ So, get yourself added to the contrib group and install gcc-2.95.2
           (or whatever is the lastest version).
                \_ They weren't whining that it wasn't installed.  They were
                   asking if it was installed.
                \_ It might help if you actually read the question, fuckwit.
2000/5/22-23 [Computer/SW/Compilers] UID:18316 Activity:high
5/22    Rephrased question: suppose you have new system header files.
        How do you change how the system searches for the default header
        files if you do not have root permission?
        \_ Rephrase it again, it's still not clear.  Header files for what?
                            \_ ;
           "system" searches for the default header files?  Do you mean
           how to change your compiler search order?  If you have new system
           header files, whoever installed them should've put them in the
           right place. -oj
           \_ #include <iostream.h> for example.  You have a new compiler
              you are trying out with a different iostream.h.  You want
              to make sure you are picking up the right iostream.h.  What do
              you do?
              \_ Take out the hostage.
                 \_ what movie did that come from again?
                    \_ The Netrix
              \_ Your new compiler should be using the new iostream.h if it
                 has one.  Otherwise read the man pages on how to set your
                 search path.  Since we're correcting, it's "shoot the hostage"
                 and it's from _Speed_. -oj
                      \_ Usual suspects had a very similar situation
2000/5/12 [Computer/SW/Compilers] UID:18245 Activity:high
5/11    What happens if you increment past MAXINT?  Is this compiler
        dependent or is this standard behavior?
        \_ Short answer: overflow
           Roundabout answer: take 61C (shame on you if you've taken it and
           don't know.
           Hands-on answer: What would the bit pattern be for MAXINT?  It
           would be a single zero followed by n-1 ones on an n-bit machine.
           On a four-bit machine, this would be: 0111 (7 base 10)
           What happens when you add 1 to said bit-pattern?  You get a single
           one followed by n-1 zeros;
           Once again, on a four-bit machine, 1000 (-8 base 10)
           Note that C does not generate an error, cause an exception, etc.
           when overflow occurs.  This is a feature.
           -dans
           \_ are you saying that overflow (as you've specified) is standard
              behavior, that it's specified that this is the way it
              should happen when you increment past MAXINT?
                \_ C's specified behavior on integer overflow is
                   undefined (3.4.3 paragraph 3, 6.2.6.2 footnote 45,
                   6.5 paragraph 5, ISO 9899). but on many modern
                   machines with gcc and two's-complement arithmetic
                   you can expect that what dans has described will
                   happen.  -brg
2000/4/5 [Computer/SW/Unix, Computer/SW/Compilers] UID:17925 Activity:nil
4/4     Is there a unix tool that will go through annoying text files
        recently edited by an MSDOS based editor and eliminate all those
        extraneous ^M characters? The compiler I'm using seems to hate them.
        \_ /usr/local/bin/fromdos
        \_ tr -d '\015'
        \_ Do the Ctrl-M's say "Controlled by Microsoft?"
        \_ My favorite is: perl -pi -e 's/\r\n?/\n/g' filename
           as this will convert both DOS and Mac linefeed formats
           to UNIX  --dbushong
2000/3/22-23 [Computer/SW/Compilers, Computer/SW/Languages/Misc] UID:17822 Activity:nil
3/21    Is there a gcc option to force labels to be outputed and to be
        included in the ELF symbol table.  I'm trying to profile this
        code:

        beginloop:
          for (i = 0; i < n; i++) {
            y[i] = a*x[i] + y[i];
          }
        endloop:

        and so I want gcc -S to produce those labels in the .s file and
        for the assembler/linker to add those to the symbol table.  I'm
        trying to profile this code using a machine simulator that looks
        at ELF symbol table code markers for performance simulations. -jefe
        \_ I suggest using gcc's extended asm. Say  __asm__("beginloop:\n");
           instead of  beginloop:  and then the assembler will add these labels
           to the symbol table. If you need them to be global symbols, it's
           easy enough to do: __asm__(".globl beginloop\n"); -brg
2000/3/8 [Computer/SW/Compilers] UID:17711 Activity:kinda low
3/7     Aside from code aesthetics, is there a reason (e.g. optimization,
        code-generation, etc) why switch/case is better than if/else?
        \_ ooh ooh! finally a question about compilers! switch/case is
            a subset of if/else: the special case (hehe) when the thing being
            compared is a small fixed-point number. Analogy: switch/case is
            to arrays as if/else is to lists. -nick
        \_ Any tricks the compiler can do on switch it can probably do on
           chained elses. So aethetics is the only good reason.
           \_ "can probably do" means "does not" -- clauses are general
              expressions, whereas case are constants known at compile-time.
        \_ Maybe if the code does switch() on a char or something small
           instead of an int, and there are many case statements, the compiler
           can possibly optimize it into a jump table using the variable as
           the search key or index.  -- yuen
        \_ I'm not saying you should, but if you want you can do something like
           switch (foo) {
           case 1:
                 if (bar) {
           case 2:
                        baz();
                }
                break;
           }
           of course if you code like that you will be taken out and shot.
                                -aspo
        \_ You can also use switches to unroll loops.
        \_ Most compilers take "switch (foo)" as a pretty strong hint that
           you're about to make many comparisons against foo and it would
           be a good candidate to keep in a register.
2000/3/6-7 [Computer/SW/Languages/C_Cplusplus, Computer/HW/Memory, Computer/SW/Compilers] UID:17696 Activity:nil
3/4     What does a Segmentation fault mean? I have a program with and gdb
        reveals that the program segfaults at
                while (x == 0) {
        It seems to segfault on one machine each time but never on another.
        \_ what's "x"?
        \_ did you malloc enuf space?
                \_ IOW, did you allocate memory for x?  Is x defined, or
                   just declared as a variable?  What type is x?
        \_ Illegal reference to memory not owned by the process
1999/12/31-2000/1/1 [Computer/SW/Languages/Java, Computer/SW/Compilers, Computer/SW/Editors/IDE] UID:17127 Activity:nil
12/30   Is there an editor out there that will analyze my code (C++, Java)
        and tell me if I have a dead variable (dead code elimination),
        visually optimize code, etc? I know that this happens in the
        compiler, but I'd like to have some kind of editor that can
        give me advice.
        \_ ED, ED, ED is the STANDARD!!! Peephole/control-flow optimizer.
1999/12/22-23 [Computer/SW/Compilers, Computer/SW/OS/Solaris] UID:17086 Activity:moderate
12/21   Need solaris sparc 2.4 gcc binary. url/ftpP
        \_ Get the source tarball from http://ftp.gnu.org and compile it on
           a solaris machine that already has a C compiler. I am still
           wondering though, _why_ would you want such an old gcc version?
           Heck, may be you should try something even older, gcc 1.x maybe?
        \_ he's asking for a version for solaris 2.4, not gcc version
           2.4 you twink. -tom
        \_ftp://sunsite.unc.edu/pub/packages/solaris/sparc/GNUgcc.2.8.1.SPARC.Solaris.2.4.pkg.tgz
          bu Tom's answer is funnier.  -ax
        thanks - paolo (the app I'm looking at was designed for 2.4, hasn't
        been ported to anything later than that.
1999/11/23-25 [Computer/SW/Compilers] UID:16943 Activity:low
11/23   Is there a cross-compiler installed on soda?  What do I have to do
        or install to compile a standard ANSI C program on soda and have it
        run under MS-DOS?  Just a very simple C program that manipulates
        files, nothing graphical and nothing windows or unix specific.
        \_ _why_ bother with setting up a cross compiler on soda when you
           can download a precompiled for dos, working version of gcc from
           http://www.delorie.com/djgpp ?
           \_ thank you!  that will work too.  I thought there was a simple
              way to do this on soda.  But gcc on dos will work.
        \_ In case there's no better answer, http://www.metaware.com used to sell a
           cross compiler called High C.  I've used its Sparc/SunOS4.1 -->
           x86/DOS version.  -- yuen
1999/11/19-22 [Computer/SW/Compilers] UID:16916 Activity:nil
11/18   So what's up with needing a compiler to install gcc?  If i had one
        i wouldn't need gcc.  Also, anyone know where i can download Korn
        or Bash for a Sun Ultra 5 running SunOS 5.7 (without a compiler!)
        -new to this stuff.
        \_ you need a compiler to bootstrap the compiler you want to make
           from source. e.g. the gnu binaries cd will have one. you can
           also download binaries from http://www.sunfreeware.com
                                       \_ man pkgadd helps too
        \_ Korn is already on Solaris - /bin/ksh
        \_ Hand coded assembly.  Wimp.
1999/9/19-21 [Computer/SW/Compilers, Computer/SW/Languages/C_Cplusplus] UID:16550 Activity:very high
9/18    what does the term "co-ed" mean?
        \_ Co-Education. It is a old term used to differentiate those
           who studied in single-sex (boys only or girls only) classes
           and those whose classes had both sexes. In the vernacular
           a co-ed means "a sexy little sorority slut".
        1: a sexy little sorority slut
        2: a sexy little sorority slut
        3: a sexy little sorority slut
        4: a sexy little sorority slut
         \-  dude, you got it all wrong.  there are some fucking ugly bitches
           in a sorority who are getting no dick whatsoever.  for example,
           i remember some fat chicks shaking their groove thing at a
           fashion show, and all was not well.
           \_ Not all sorority girls are there to get dicks.  It's only the few
           \_ that's why the term does not apply to them.
           \_ BOOL Chick::isSexy() { return !this->isUglyBitch(); }
              \_ Back in the old country, people would be grateful for
                 any pointers they could find.
              \_ Get with the program.  "bool" is now a fully qualified
                 type.  You don't need to use "BOOL."
                 \_ Since when?
                    \_ Since November 1997.  Of course, windows still
                       depends on it....
                          \_ true/false (all lowercase)
                       \_ This is ANSI C/C++ right? What are the values
                             ANSI C++ compiler - which last I checked no
                          for bool (true/false of TRUE/FALSE or 1/0)?
                          \_ ANSI C++ only.  And only if you have a true
                                to work in egcs-2.91.66 19990314 (egcs-1.1.2).
                                I think that I'll stick to BOOL or int until I
                                can confirm that the SunPRO compilers handle it
                             C++ compiler had been certified as 100% compliant
                \_ Only on the csua motd would a rant about ugly sorority
                   chicks which started as a simple semantic query turn into
                   a lesson on the latest aspects of coding.
                   \_ Which, of course, is why I started it.
                      \_  heehee, this garbage is too funny.
9/
16      How do I pipe to an rsh? Say I want to do
        sort file | rsh machine -l user cat > file.sort
        \_  Assuming you have rsh set up properly do something like
            sort file | rsh machine -l user "cat > file.sort"
            or
            sort file | rsh machine -l user dd of=file.sort
            -ERic
                             \_ I just tried a simple program and it seems
                                correctly.
1999/8/23-24 [Computer/SW/Compilers] UID:16373 Activity:low
8/22    Anyone know of free ansi cobol compiler for unix?  Beta is ok.
        \_ Y2K problems?
1999/8/19-23 [Computer/SW/Compilers, Computer/SW/WWW/Server] UID:16344 Activity:moderate
8/19    Anyone have any experience setting up name based virtual hosts using
        Apache?  This is fake but I have one IP, 128.56.139.5, and two
        name entries http://foo.com and http://bar.com.  In my httpd.conf file I have

        <VirtualHost 128.56.139.5>
        ServerName http://bar.com
        DocumentRoot /~jondoe
        <VirtualHost>

        but now when I type http://foo.com or http://bar.com into the
        browser it gives me the message
        "Not Found The requested URL / was not found on this server."
        Anyone know what's wrong with this.
        \_ Apache doesn't grok "~"; use a full path.  -tom
                \_ grok?  y00 R s0 ]<-00|_ !!!111
                \_ D00de!  Warez y0r dikshunary?  Wutz 'gr0k' meen? U R K00l!11
                  \_
  grok /grok/, var. /grohk/ /vt./  [from the novel
     "Stranger in a Strange Land", by Robert A. Heinlein, where it
     is a Martian word meaning literally `to drink' and metaphorically
     `to be one with'] The emphatic form is `grok in
     fullness'. 1. To understand, usually in a global sense.  Connotes
     intimate and exhaustive knowledge.  Contrast {zen}, which is
     similar supernal understanding experienced as a single brief flash.
     See also {glark}.  2. Used of programs, may connote merely
     sufficient understanding.  "Almost all C compilers grok the
     `void' type these days."

        \_ d00de, t0m iz ay MARSHUN??? thatz r/-\d!!!11
           \_ gr0k!!111 tom iz s0 k00l h3 kan gr0k!@111!11 d00ewde!!!@
           \_ Y d0 yu kepe rem00vein mye k-rad c0mmetz 2 t0M?  eye leik t0m,
              hez s0 k00l cuz hez D gr0k mast0r!11  t0m iz rad!11  t0m iz rad!1
              t0m iz rad!1 t0m iz raf!!1 yeh d00dez r0k 0n!1111
        \_ Not only that, but grab the latest (1.3.9) for better
           virtual hosting features.
1999/8/18-20 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers] UID:16336 Activity:nil
8/19    C question: I rarely, if ever, remember to include stdlib.h, which
        includes malloc, atoi, etc. But I use these functions on a regular
        basis. I haven't encountered a problem until I tried using atof(...)
        also in stdlib.h. Once I included stdlib.h, my problems went away.
        So why didn't I have problems with the other functions?
        \_ your compiler was assuming that undefined functions returned an int.
                          \_ I think you misspelled "may have been"
           that was not a valid assumption in the case of atof.
           you should pay attention to those warnings from your compiler
           instead of ignoring them.
1999/8/9 [Computer/SW/Compilers] UID:16272 Activity:high
08/08   After a release this crappy, how can I bring myself
        to ever trust cygnus to maintain gcc?

        They release a combination of gcc + "libgjc" especially for
        that release..., where gcc 2.95 does not compile libgjc
        (intel, solaris)
        Not to mention their build dependancies are so crappy,
        they insist on rebuilding .o files I have just
        carefully built by hand. Gaaaah!!

You see no motd.
> go north
1999/7/31 [Computer/SW/Compilers] UID:16218 Activity:high
7/31    See the source code of one of the first C compilers by the creators
        of BSD.  It's surprisingly small:
        http://www.cs.bell-labs.com/~dmr/primevalC.html
        \_ try inventor of UNIX.  BSD came around 10 years later.  -dpetrou
1999/7/11-14 [Computer/SW/Compilers] UID:16105 Activity:high
7/11    Since bison/yacc/(f)lex all act like state machines is there any way
        to implement a program with multiple context parsers (eg. a
        multithreaded network deamon that needs to parse an input)?
        \_ This problem is even worse in OpenGL that employ specialized
           rendering hardware since the GL libraries act on the state of
           the video card.  In other words, there's only one rendering
           pipeline and you can't have multiple GL renderers (except on SGIs).
           \_ that's just sorry-ass driver design. 2D drivers also act
              directly on hardware but have been abstracted to share between
              clients efficiently.
        \_ flex & bison both allow you to specify names for your parser/scanner
        \_ Fuck bison and yak and all that shit!  LINUX RULEZ!  Use Linux
           instead!
           so you can have multiple per program - read the docs.
           \_ name changing wouldn't work if you want to have multiple
              instances of the same parser.  too bad there's no OOP parser.
              \_ There is.  Search for PCCTS and ANTLR.  Current development
                 is in java, but the C++ version still exists.
        \_ search on bison++ and flex++ for generators to get
           C++ encapsulated parser and scanner objects.  these may be
           simple option flags to standard bison and flex these days...
           \_ -+ for flex
1999/7/10-12 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers] UID:16101 Activity:low
7/9     Know of any C++ compilers for Linux/x86?
        Please add to the list:    (--PeterM)
        \_ egcs
        \_ Kai C++ (KCC)
        \_ Fujitsu C++ (FCC)
        \_ Portland Group C++ (pgCC)
        \_ Yermom C++ (ymCC)
           \_ This one sucks.
              \_ I thought it blows.
1999/4/27-28 [Computer/SW/Compilers, Academia/Berkeley/CSUA/Motd] UID:15704 Activity:nil
4/26    Have a friend recruiting for a company looking for a DRAM core
        designer with a couple years experience.  mail jed
        \_ LJBF! LJBF!
          ( Subtle, desparate long-term torture plan )
        \_ This is the WRONG place for a question like this.  Do what you
           think is right.  Make sure you have no regrets, and make sure
           you're proud of yourself after whatever you do in the name of love.
           I'd call her and ask her why.  It is not a question of whether
           she is testing you, or if this is a game, it is about
           communication -- if she still turns you down, then you know it's
           the real thing. --female@soda
           \_ Why is it wrong to ask for advice in relationship matters on
              the motd? After all if you were having trouble in your relationship
              with your compiler or your computer, asking for help on the motd
              generates useful feedback. Anyway, since most of my friends read
              and post on the motd, asking here or in person would be the same.
              (Actually the motd is better since its anonymous).
              In this particular case I'm betting that the post was made on
              the motd, so that the female in question would read it and
              reconsider her decision.
        \_ You know, I bet a lot of these relationship questions that show
           up on the motd are purely hypothetical, posed for the entertainment
           value of the responses.
        \_ "Go to her.   Don't sleep on it.  It's not always good to let things
            calm down...The best thing you have going for yourself is your
            willingness to embarass yourself." - Simon advising Melvin from
                As Good As it Gets
        \_ I say go for it. Who cares about experience? Just be yourself and
           "go for the gold!"
1999/4/4 [Computer/SW/Compilers] UID:15692 Activity:nil
4/2     A while ago someone said that the difference between .so files and .a
        files is that .so files are used for dynamic linking while .a files
        are for static linking.  Then what is the difference between .a files
        and .o files?
        \_ The .a file is a bunch of .o files, packed together with ar(1).
           Most compiler tools understand .a files and let you use them just
           like .o files.
1998/12/19-20 [Computer/SW/Compilers] UID:15128 Activity:nil
12/18   for you entertainment and amusement, the TenDRA c/c++
        compilers have been installed.  man tcc for a brief intro.
1998/11/10-11 [Computer/SW/Compilers] UID:14939 Activity:moderate
11/10   I'd like to implement a simple C compiler for a theoretical
        architecture (a simple one) to have test code for a simulator.
        Ideally, I'd just like to modify the backend of (say) gcc.  What is
        the simplest way to do this?  I know that gcc can output assembler,
        but can it output pseudo-code?
        \_ I would check out the book "a retargetable c compiler"
           and download lcc.
        \_ don't forget that you also have to modify the backend of binutils.
           I'm trying to do that myself for another architecture and it's not
           easy.
           \_ Actually, I'm not looking for a full implementation--don't
              care about the linker etc.  At least not to start with.
1998/9/25-26 [Computer/SW/Languages/Java, Computer/SW/Compilers] UID:14671 Activity:moderate
9/24    http://seanreilly.com/java/moneydance.html
        Quicken down, 1 less reason to use non-UNIX OSes...how many more to go?
        \_ Linux is pretty good for java apps because it has native
           processor support (kaffe) that no othe os's have.
           \_ what are you talking about, "native processor support"?
           That would normally mean "the processor natively supports java",
           which is obviously false. Do you mean "JIT compilation"?
           kaffe does that on lots of platforms.
           Do you mean "compiles to actual executables"? The kaffe web pages
           don't say it can do that, and I don't think it can.
                \_ there are java->native cpu compilers for other OS'es though
                        linux loses
                   \_ yah. What kaffe wins on will be its new awt
                       implementation. That is, when it actually works.
                       (it will run on DOS, though. wow. http://www.kaffe.org
           Do you mean "you can type the name of a java class, and it runs"?
           So WHAT?
           \_ From the RH linux package description on kaffe:
                "This is Kaffe, a virtula machine design to execute Java
                bytecode.  This machine can be configured in two modes.
                In one it operates as a pure bytecode interpreter (not
                unlike Javasoft's machine); in the second mode it performs
                "just-in-time" code conversion from the abstract code to
                the host machine's native code.  This will ultimately
                allow execution of Java code at the same spped as standard
                compiled code but while maintaining the advantages and
                flexibility of code independence."
                -RH linux installation guide
                \_ Note#1: linux was one of the LAST packages to get a JIT
                   compiler, compared to other major platforms
                   Note #2: THIS DOES NOT  "allow execution ... at same speed"
                   because real C code gets better optimization from the
                   compiler. And incidentaly, kaffe supports JIT on linux,
                   solaris, and a few other platforms. This is NOT
                   linux-specific in any way, shape or form.
            \_short summary: the above linux bigot is an idiot who wouldn't
                know a java compiler from a hole in his head
        \_ this looks kinda neat :)
1998/8/19-20 [Computer/SW/Compilers] UID:14482 Activity:nil
8/19    http://www.trimaran.org
1998/7/24 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers] UID:14379 Activity:nil
7/23    What C/C++ compilers are being used in the workplace for Windows
        software development?
        \_ VC++ is probably the most widely used
        \_ Borland C/C++ or C++ Builder.
1998/5/6-8 [Computer/SW/OS/Misc, Computer/SW/Compilers] UID:14057 Activity:kinda low
5/6     Can I use gdb on one host to debug a process running on a remote
        host via the network (not serial line)?
        \_ telnet to the host and start gdb. no, of course not, what is
           the point? you do this over serial for kernel debugging
           because it's necessary. why do you want to do this? why can't
           you log into the host? how would this work? i mean something
           has to sit on the host and interpret your commands and apply
           them to the harnessed process -- why can't that be a shell and
           gdb? i'm completely boggled by your POV. --aaron
        \_.. yes. (Now we wait in suspense for you to ask how) --daveh
        \_ i still think this is a "let me give you some artificial constraints
           without telling you enough about the problem to make useful
           suggestions" type of post. maybe if you gave us more info. --aaron
           \_ Nobody said the remote host was running telnetd or even unix.
              Debugging via tcp/netbios/ipx is very useful.  To answer the
              original question, no.  Cygnus might have some custom shme
              but all the gdb tethering I've seen so far is serial. --pld
        \_ That is standard procedure in most Real Time OS like PSoS or
           VxWorks/Tornado.  You run the debugger on one host and connected
           it via network or serial line to a target processor.  What OS is
           running on the target?  And if this is work-related, shouldn't
           you be asking your project leader?
           \_ Fear.  Maybe he *is* the project leader?!
           \_ He did say "process", not "OS"...
1998/4/10 [Computer/SW/Languages/Java, Computer/SW/Compilers] UID:13930 Activity:nil 60%like:14178
4/9     What's the difference between a programmer and a software engineer?
        \_ programming is a specialization of engineering. A programmer, like
           any engineer, CREATE things (programs) that IMPROVE the mankind.
           However, an engineer doesn't necessarily know how to program.
        \_ programmers write code, software engineers design it
           \_ so software engineer never code, and programmers never design?
              take a rhetoric class!
        \_ software engineers can make their code run even in hostile
           environments (crappy hardware, limited memory, buggy compilers,
           tethered debuggers that make gdb look high-tech, and so on)
        \_ Hiearchy is this:
                -software engineer
                -programmer
                -hacker
1998/4/8 [Computer/SW/Compilers, Health/Sleeping] UID:13921 Activity:very high 66%like:13922
4/8   So how much sleep does the average CS student get around here?
        \_ depends on class and date. When I took 152 and 184 the same time I
           average anywhere between 0-24 hours of sleep. Mean was like 5-6 hours
           at best. It wasn't pleasant
                \_ depends on professor too. FUCK YOU AIKEN!!!!!!!!!!!!!!!!!
                        \_ I had plenty of sleep when I took 164 under
                           Aiken.  You must suck.
                \_ If I get laid, maybe two hours a night. So I sleep
                   about an average of twenty hours a week.
                   \_ I spent some sleepless nights during the final phases of
                      writing my Cool compiler for 164, but I'm sure that I
                      did much better in Aiken's class, sleep-wise (and grade-
                      wise), than if I'd waited a semester to be part of
                      Hilfinger's first experimental "hey, let's write a Java
                      compiler" 164 class.  Aiken was _hardly_ that bad.
        \_ I've graduated.  I get around 5 hours of sleep on average during
           the week.  Sometimes as much as 7 but thats pretty rare.  3 happens
           too.
1998/3/31-4/1 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers] UID:13877 Activity:kinda low
3/30    Anyone using Stroustrup's The C++ Programming Language, 3rd ed?
        I can't get the example code to compile, p61, the one about
        iteraters. gcc doesn't even recognize #include <iostream> and
        I was able to get the code to almost compile under VC++ 5.0 with
        one final error, cannot convert parameter... for the vector line.
        any hints? Thanks a lot.
        \_ a)  gcc doesn't even really support a lot of Stroustrup 2nd ed
           features.  Come to think of it, most C++ compilers are broken
           in one way or another.
           b)  Try #include <iostream.h>
        \_ C++ is dying.  Anyone know of a hugely successful commercial app
           written entirely in C++?  Netscape is written in C.  IE is written
           in C.  All of Windows API are in C.  So are the X windows API.
           C++ zealots, drop dead and die.
                \_ iostream.h doesn't provide namespace, etc.
        \_ troll deleted
        \_ gcc does not support STL.  iostream.h != iostream, the latter
           is an STL thing - android
        \_ so which compiler did Stroustrup use??#@$
           \_ I'm not sure if one exists.  C++ is in such a B0rKen state
              semantically, and I'm not sure if the ANSIfication won't make
              the problem worse.  I doubt you will see compilers
              properly supporting the whole standard for at least a year
              after the "standard" is formalized.
1998/3/13-14 [Computer/SW/Compilers] UID:13803 Activity:very high
3/13    Anyone know of a better compiler for Linux than gcc/g++?
        We're willing to pay for a compiler if we get a significant perf.
        increase.  --PeterM
        \_ I heard that MSLinux for Windows will allow you to run MS C++ v5.5
        \_ Hand code optimization (algorithm, method, etc) will do much more
           improvement than small incremental compiler optimization. At any
           rate, if you require performance on Linux and PeeCee, then perhaps
           you should be looking at different platforms.
                \-is the person actually trying to be helpful?
           \_  Compiler is a lot cheaper, usually, than a new machine.
               I want more performance without having to shell out for a
               whole new machine.  --PeterM
        \_ I bet this guy is trying to run brute root crack.
                \_ Why bother?  There are plenty of exploits available on
                   the net.  I doubt most systems are patched for all of them.
                   \_ I've always depended on the idiocy of motd entries.
                      -- Bland DuBois
1998/3/9-10 [Computer/SW/Compilers] UID:13775 Activity:moderate
3/8     I'm looking for help with gcc/gdb for HP-UX 10.30.  I've got gcc
        compiled, but gdb refuses to compile.  If anyone knows of a site
        with pre-compiled binaries, or has compiled these on HP-UX 10.X
        before, please let me know.  -davidf
        \_ Also, if you have any ideas for other reliable compilers/
           debuggers for HP-UX, I'd be interested in those.  -davidf
                \_ Buy HP-SUX's langtools package. Other than gcc you're
                        out of luck.
1998/3/6-12 [Computer/SW/Compilers] UID:13766 Activity:nil
3/6     gcc-2.8.1 & libstdc++-2.8.1 are in /csua/tmp/gcc for your bandwidth
        preserving pleasure.  There is no libg++-2.8.1.
1998/1/21 [Computer/SW/Compilers, Academia/Berkeley/CSUA] UID:13534 Activity:nil
1/14    gcc 2.8.0 & libstdc++2.8.0 are in /csua/tmp, courtesy of alanc & peterm
        \_ what are the main improvements?  Isit stable?
                \_ /csua/tmp/gcc-2.8.0.changes
1996/1/8 [Computer/SW/Compilers] UID:31791 Activity:nil
12/30   gcc 2.5.8 is now installed and apparently working.
        gcc 2.7.2 is installed as /usr/local/bin/gcc; it does NOT work with
        the -g option, use gcc-2.5.8 or cc if you need -g.
        gnu ld does not work properly yet.

                     PUBLIC MESSAGES BELOW THIS LINE
1994/1/28 [Computer/SW/Compilers, Computer/SW/Unix] UID:31468 Activity:nil
1/27    gnu as (gas) updated to version 2.2. It's not a perfect port, but it
        works.
        gcc updated to 2.5.8, supposedly the 'last' of the 2.5 line. (sheayah,
        right!) lemme know if it breaks anything.  -ERic
        gmu make is now updated to 3.70.  its /usr/local/bin/gmake.  -ERic
1993/5/12-13 [Computer/SW/Compilers] UID:31314 Activity:high
5/11    g++ (GNU's C++ compiler) installed.  Many thanks to mehlhaff for
        finally getting gas working.
        \_ Does this mean we can play xlords of Conquest on soda now? - norby
2024/11/23 [General] UID:1000 Activity:popular
11/23   
Results 1 - 150 of 168   < 1 2 >
Berkeley CSUA MOTD:Computer:SW:Compilers:
.