Berkeley CSUA MOTD:Entry 28189
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2025/07/08 [General] UID:1000 Activity:popular
7/8     

2003/4/22-23 [Computer/SW/Languages/C_Cplusplus] UID:28189 Activity:insanely high
4/22    Anyone know a good link that explains all of C++'s use of the
        keyword mconst?
        \_ http://www.parashift.com/c++-faq-lite
           Search for const in the text box.
           Search for mconst in the text box.
           \- perfection
              \_ The real PSB would know this already.  Wouldn't he?
                 \_ who the hell said i was psb. i'm not. -!psb
                    \_ the \- is a psb thing.
                       \_ only if tailed with "ok tnx." and the spacing has
                          to be foobared.
                          \_ The psb shall do as He pleases!  --psb #1 Fan
        \_ we haven't had a good C++ discussion in a while.  It's time to
           revisit.  Anybody use C++ in a truly object oriented manner?  Does
           true OO even exist outside of the some lame-ass textbook example
           on how the truck class is inherited from the automobile class?
           Every C++ prog I've seen is about encapsulating data (foo->bar = 1)
           and doing function calls (foo->func(1)).  The latest C spec allows
           you to do both.  So what exactly is the point of OO?
                \_ inheritance, virtual funcitons, templates (not really OO)
                   all make life a lot easier.
                        \_ inheritance makes life EASIER!?!
                           have you ever been involved in a
                           big C++ project?
                           \_ my personal, limited experience told me that
                              inheritance is not bad, but multiple-
                              inheritance is pain in the butt (i.e at least
                              our company never managed to used it properly
                              enough to be useful IN THE LONG RUN)
                           \_ He probably knows someone who took a class from
                              BH.  Does that count?
                           \_ yes and yes.  Yes, inheritance can be a headache
                              if used poorly, but so can everything.  Used
                              well, inheritance is a godsend.
                           \_ My current job is a scientific application with a
                              few 100K lines of code.  Fully C++.  Yes,
                              inheritance makes life easier.
                              \_ It's probably a matter of opinion.  But
                                 generally, use composition over
                                 inheritance.
                                 \_ I am so glad I don't work with you.
                                    \_ how do you know you don't?
                                 \_ Are you a total idiot?  Use the right tool
                                    for the right job.
           \_ i think you should read stroustrup 3rd ed and go argue on
              comp.std.c++
2025/07/08 [General] UID:1000 Activity:popular
7/8     

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