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

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!!!
           \_ True, it's better than C for many purposes, but at the very
              least it has some serious lexing/syntax issues.
              \_ Most of the warts stem from backwards compatibility with C
                 (primarily integer promotion, operator precendence, etc.).
                 \_ Bull... Shit... Things which are broken in C++:
                    Confusing Scoping Operators
                    Confusing auto creation vs. explicit instantiation of objects.
                    Confusing auto creation vs. explicit instantiation of
                      objects.
                    Ability to overload things like new.
                    Ability to do crappy stuff like delete this.
                    Multiple Inheritance
                    Friends (god, wtf was Bjarne thinking?)
                    Sticking classes in .h files.
                    Templates (good idea, but crap implementation).
                    STL was too damn late in coming so nobody uses it.
                    Language is too frickin' big.
                    We should've adopted Objective C over C++. C++ is just
                    a dog of a language. Just take a look at MFC and its mess.
                    \_ cs61b got you down?  I've actually seen alot of the
                       stuff on your list used in VERY effective ways.  Most of
                       your complaints sound like the things newbies whine
                       about.  Train harder, grasshopper.
                    \_ A lot of the things you list are not broken.  Just
                       because something is confusing to _you_ does not make
                       it 'broken.'  Just because something is an advanced
                       feature for which you see no use (overloading new) does
                       not make it broken.  However, I will agree that C++ is
                       combining too many worlds in a poor and inelegant way.
                       Still, I have to respect it in that you CAN get work
                       done in it. -- ilyas
                       done in it.  We would not have been better off with
                       ObjC over C++, though ObjC is certainly a much
                       smaller language.  One reason is, ObjC uses essentially
                       the smalltalk object system, which is not suitable for
                       many systemy kinds of programming. -- ilyas
                       P.S.  My favorite MFC moment is seeing stuff like:
                       template <class T> class Foo : public T { ... }
                       \_ This is typically called a shim class.  And?
                          \_ There is no and.  I just find the idiom amusing.
                    \_ You learned Java before C++ right?  It's hard to move to
                       a real language after playing with toys for a while.
                       I've used all the above features well, and use STL
                       heavily.  (You didn't even mention streams.  Amateur.)
                    \_ Actually, I was thinking more of obvious stuff like
                       the << and >> template problems, and the fact that
                       :: is both the namespace separator and the name for
                       the "global namespace." (Which becomes a problem
                       when the C++ lexer throws away whitespace...) -op
                       \_ How is :: the "name" for the global namespace?
                          If it were, then you'd access globals by ::::foo,
                          yes?  Isn't the "name" for the global namespace
                          epsilon (nothing)?  :: is always a namespace
                          separator.
                          \_ Sorry I didn't state it in explicit theory
                             terms, but it amounts to the same thing.  If
                             you want to specify the global namespace, you
                             begin the identifier name with ::.  ie
                             ::foo:bar.  I was just using the same
                                  \_ A single colon is not a namespace
                                     separator.  Did you mean ::foo::bar?  Are
                                     you sure you're programming in C++?
                             terminology used in a C++ book I read a
                             while ago.  It maybe have been Bjarne, but I
                             can't remember exactly.
                             \_ Errr, read the post above you again.  pp is
                                exactly right. -- ilyas
                                \_ Errr.. read my post again, I agreed
                                   with him.
                             \_ Right.  This works just like Unix pathnames --
                                foo/bar is a relative path, and /foo/bar is an
                                absolute path.  What problems does it create?
                                Yes, >> in templates is stupid.
                                \_ I just had this experiance, if you have
                                   2 identifiers in a row, ie "id1 id2",
                                   and you try to force the global id2,
                                   C++ throws out the white space, so
                                   instead of having two identifiers, you
                                   get 1 big identifier "id1::id2", which,
                                   of course, it can't find.
                                   \_ That doesn't even make sense.  White
                                      space separates tokens.  I don't think
                                      you know what you're talking about.
                                      \_ Maybe it's only true in gcc 3.4,
                                         go ahead and try it.
                                         \_ I don't have access to gcc 3.4 (nor
                                            do I want it).  That sounds like a
                                            bug in a compiler, not a language
                                            flaw.
                                         \_ It doesn't make sense, and you
                                            haven't provided enough instruction
                                            about how to reproduce it.  What
                                            do you mean "have two identifiers"
                                            in a row?  When would that be legal
                                            at all?  In what context?  How
                                            about some real code?
                                            \_ If you like:
                                #include <iostream>

                                class B { };

                                class A {
                                 public:
                                  B foo();
                                };

                                B ::A::foo() {
                                  std::cout << "Hello" << std::endl;
                                  return B();
                                }

                                int main() {

                                  A a;
                                  a.foo();
                                  return 0;
                                }

        fails with this error:
        test.cc:11: error: `class B::A' has not been declared
        test.cc:11: error: ISO C++ forbids declaration of `foo' with no type
                        \_ But you shouldn't need to have (or be expected to
                           have) the global namespace qualifier in A::foo's
                           definition anyway.  How about an example where it's
                           actually a problem?  The scoping operator (::) does
                           need to discount whitespace, because otherwise you
                           wouldn't be able to break apart really::really::
                           long::lines.
                           \_ The case where I ran into this as a "real
                              problem" spanned multiple files and
                              thousands of lines of code.  So I contrived
                              an example.  I'm pretty sure that's a normal
                              thing to do.
                              \_ Explain how.  C++ doesn't allow nested
                                 functions, so you either define functions
                                 in global scope or within a namespace.
                                 If you're already in global scope, you
                                 don't need the leading ::.  If you're not
                                 in global scope, why are you defining a
                                 function in one namespace from within another?
                                 \_ And inablilty to explicitly declare a
                                    function in global scope doesn't
                                    strike you as a little wierd?  Even if
                                    it is usually unnecessary?  I never
                                    said I couldn't do something else.  I
                                    did something else and it worked, that
                                    doesn't mean this isn't bad design.
                                    \_ And it doesn't strike you as weird that
                                       you want to do something like:

                                        class A {
                                          void f();
                                        };

                                        namespace foo {
                                           void ::A::f() { }
                                        }

                                       ?  I mean, really.  Even if you could
                                       do it, you're just making your own
                                       code more unmaintainable by defining
                                       functions where they don't belong.
                                    \_ I think you must be using non-C++
                                       concepts and trying to for them into
                                       C++.  By the same token, you can't take
                                       English idioms and translate them word-
                                       for-word into Spanish.
                                       \_ Most of my work is research
                                          outside the concepts of any
                                          language.  SO yeah.
                                    \_ No, it doesn't seem weird.  Most
                                       lexically-scoped languages allow things
                                       to be declared only in the current
                                       scope.
                                       \_ Maybe so, but in C++ you have to
                                          define methods explicity in a
                                          namespace, but you can't
                                          expicitly declare the namespace.
                                          Perhaps you could argue that
                                          it's just an unfortuate mix of
                                          C++ features, but that's bad
                                          design isn't it?
                                          \_ What do you mean?  You don't
                                             have to define methods explicitly
                                             in a namespace (you put them
                                             within a "namespace ns { ... }"
                                             block).  And how is that not
                                             explicitly declaring the namespace
                                             itself?  And no, it's not a bad
                                             design.  Have you not noticed that
                                             you alone seem to be the only
                                             person who has any issues with
                                             this?  Sane programs written
                                             properly won't have these issues.
                    \_ Let's all switch to http://digitalmars.com/d
                       \_ BCPL is the STANDARD!
2025/07/09 [General] UID:1000 Activity:popular
7/9     

You may also be interested in these entries...
2012/7/19-11/7 [Computer/SW/Languages/C_Cplusplus] UID:54439 Activity:nil
7/19    In C or C++, how do I write the code of a function with variable
        number of parameters in order to pass the variable parameters to
        another function that also has variable number of parameters?  Thanks.
        \_ The usual way (works on gcc 3.0+, Visual Studio 2005+):
               #define foo(fmt, ...) printf(fmt, ##__VA_ARGS__)
           The cool new way (works on gcc 4.3+):
	...
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/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/4/13-14 [Computer/SW/Languages/C_Cplusplus] UID:13175 Activity:high
4/13    How much C++/C knowledge do recent Berkeley CS/EECS grad have?
        \_ Class CSGrad inherits FromDaddy and does not implement C++Knowledge
           very well.
           \_ funny.  just the rich and poor as always.  the middle class can't
              afford education.
        \_ They know how to deal with pointers and addresses, malloc and free.
	...
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/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.
	...
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
	...
2002/11/5 [Computer/SW/Languages/C_Cplusplus] UID:26409 Activity:high
11/4    I'm having a problem formatting inline elements in xsl-- I have to
        handle the situation where
        <school>I graduated from
          <link href="<DEAD>www.berkeley.edu"<DEAD>Cal</link> in 1998.
        </school>
        My current template is like this:
	...
2001/3/17-18 [Computer/SW/Languages/C_Cplusplus] UID:20827 Activity:high
3/16    Why does so much C sample code use #define instead of const?
        \_ because any good C code will use a bunch of preprocessor
           anyways. you can't be a good C programmer and eschew the
           preprocessor. For that, you need a language which fills those
           gaps with other constructs (c++ templates go a long way to
           obviate the need for preprocessor for example). you
	...
2000/11/21 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Languages/Java] UID:19871 Activity:very high
11/21   All java class inherites from class *Object*, if I have three classes
        A, B, and C all have one same method showErr().  If I want to have a
        function that can call showErr() depending on the object that I passed
        in, eg.
                public void handleErr(Object o) {
                        o.showErr();
	...
2000/8/9-10 [Academia/Berkeley/Classes, Computer/SW/Languages/C_Cplusplus] UID:18929 Activity:high
8/8     How well do UCB EECS and CS newgrads know C/C++? (in general)
        \_ If it makes you feel any better, Stanford undergrads start out
           take 3 quarters of "Introductory Programming" in C instead of
           SICP.
        \_ on average, better than other schools' new grads, with a
           lot more upside
	...
2000/4/6-7 [Computer/SW/Languages/C_Cplusplus] UID:17942 Activity:very high
4/6     C vs. Java vs. Perl comparisons:
        Conclusion: C is still the fastest. Java is not as slow as people
        think it is. Perl is nowhere close to Java performance.
        \_ Apples, Oranges, Bananas, and Trolls who like to delete
                \_ Multithreaded java with native threads with a
                   decent rt gives you functionality that you can
	...
Cache (73 bytes)
digitalmars.com/d -> digitalmars.com/d/
FRAME: toc.html FRAME: view_frame * Table of Contents * Introduction to D