Berkeley CSUA MOTD:Entry 47355
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2025/05/25 [General] UID:1000 Activity:popular
5/25    

2007/7/20-22 [Computer/SW/Languages/C_Cplusplus] UID:47355 Activity:nil
7/20  I was handed a templeted code that builds with gcc3.3.3 but not 3.4.4.
      I'm not all that hot with templetes, so I'm having trouble figuring
      out what's wrong.  The error I get is:
        TxBoundedFunctor.cpp:29: error: `template<class RetType, class ArgType>
           class TxFunctorBase' used without template parameters
      where TxBoundedFunctor extends TXFunctor extents TxFunctorBase. Like so:
        // Constructor specifying the pointer to a functor and the dimension.
        template <class RetType, class VecType>
        TxBoundedFunctor<RetType, VecType>::
        TxBoundedFunctor(size_t dim) :
          TxFunctor<RetType, VecType>(dim), TxBounds<VecType>(dim) {
            TxFunctorBase::className += ":TxBoundedFunctor"; }

         Any idea why it won't build with 3.4.4, but will in 3.3.3?
         \_ First, it's "template" not "templete".
            Second, can you post the code to a public file so we don't have to
            parse it from the motd and guess what comes before it?
         \_ Note: this is called a 'pastebin'
            Third, you're never able to get away with dropping template arguments,
            and it's most likely that GCC dropped a nonconforming extension.
            Checking the release notes for 3.4:
            http://gcc.gnu.org/gcc-3.4/changes.html#cplusplus
            G++ is now much closer to full conformance to the ISO/ANSI C++
            standard. This means, among other things, that a lot of invalid
            constructs which used to be accepted in previous versions will now be
            rejected. It is very likely that existing C++ code will need to be
            fixed. This document lists some of the most common issues.

            Here it is:
            In a template definition, unqualified names will no longer find
         members of a dependent base (as specified by [temp.dep]/3 in the C++
         standard).
            members of a dependent base (as specified by [temp.dep]/3 in the
            C++ standard).
            \_ That appears to be it, thanks.  Prefixing with this-> works.
2025/05/25 [General] UID:1000 Activity:popular
5/25    

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/4/29-5/1 [Computer/SW/Languages/Perl] UID:37411 Activity:moderate
4/29    I need help getting information off a web site.  A page presents
        information about an item in locations spread througout the page.
        Each page presents information about one item. What is a quick and
        easy way to go through several pages, capture all the information
        related to each item, and put them into a spreadsheet with a unique
        index?  I think this might be possible by scraping the screen, but how
	...
2004/11/5-7 [Computer/SW/Languages/C_Cplusplus] UID:34697 Activity:high
11/5    In C, why is the "offsetof" macro defined to be of type size_t but not
        ptrdiff_t?  Thx.
        \_ Probably because ptrdiff_t is signed and size_t isn't.
           \_ How does being signed make ptrdiff_t less portable?
              \_ Imagine a 16-bit C implementation, where int is 16 bits, long
                 is 32 bits, and the maximum object size is 64k - 1.  size_t
	...
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/30-31 [Computer/SW/Languages/C_Cplusplus] UID:33228 Activity:high
8/30    Ok this is pretty basic but... is there a way to "escape" text to
        avoid it being substituted by C preprocessor macro expansion?
        \_ Wouldn't that functionality make C preprocessing as powerful as
           lisp's quasiquote/escape? -- ilyas
           \_ Squish!  Isn't it illegal to talk about lisp on the motd?!
        \_ In general no.
	...
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/7/13-14 [Computer/SW/Languages/C_Cplusplus] UID:32265 Activity:high
7/12    Someone please explain the following?
        ((size_t )& ((SomeVar *)0)->Field);
        \_ It's a hideous abuse of C++ syntax and results in undefined
           behavior.  It appears to be an attempt to find out the offset of the
           member "Field" in the class/struct type SomeVar.  Ow, ow ow.
           \_ This is actually not undefined, in C or C++.  It is hideous,
	...
2004/7/5 [Computer/SW/Languages/Perl] UID:31164 Activity:high
7/4     Is there something like a macro in Perl?  Couldn't find any in
        the Camel book.
        \_ If you truly need macros in Perl, you probably want AUTOLOAD.
           Of course, if you truly need macros, Perl is the wrong language for
           what you are doing.  -- ilyas
        \_ I don't know perl, but don't almost all interpreted languages have
	...
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/8/29-2004/2/14 [Computer/SW/Languages/C_Cplusplus] UID:12260 Activity:nil
2/13    Where can I get c macro specifications? What keywords to look in
        google?
        \_ You might also want to find a good book on the specification of
           English, so you don't have to look like an ignorant tool asking
           a simple C question.
        \_ what do you want to know?  There's the C language spec that you
	...
2003/11/26-27 [Computer/SW/OS/FreeBSD] UID:29671 Activity:nil 88%like:11228
11/26   what preprocessor macro is defind on FreeBSD so that I can write
        conditional code only for FreeBSD? i am using gcc...
        What about solaris? Thanks.
        \_ You can use __FreeBSD__ and __sun to tell the difference between
           FreeBSD and Solaris; you can also use __i386 and __sparc if you
           want to know the CPU type.  (These all work with Sun's C compiler
	...
Cache (8192 bytes)
gcc.gnu.org/gcc-3.4/changes.html#cplusplus
Before reporting a bug, please make sure it's really GCC, and not your code, that is broken. It was neither documented nor intended that environment variable paths be ignored, so this has been corrected. It is unlikely that they worked correctly in any 3x release. As a result, the code generated will not be binary compatible with earlier releases in certain cases. As a result the parameters of -finline-insns, --param max-inline-insns-single and --param max-inline-insns-auto need to be reconsidered. Code relying on some particular ordering needs to be updated. The majority of such top-level asm statements can be replaced by section attributes. This may result in undefined references when an asm statement refers to the variable/function directly. In that case either the variable/function shall be listed in asm statement operand or in the case of top-level asm statements the attribute used shall be used to force function/variable to be always output and considered as a possibly used by unknown code. For variables the attribute is accepted only by GCC 34 and newer, while for earlier versions it is sufficient to use unused to silence warnings about the variables not being referenced. To keep code portable across different GCC versions, you can use appropriate preprocessor conditionals. Again the attribute used shall be used to prevent this behavior. As a temporary workaround, -fno-unit-at-a-time can be used, but this scheme may not be supported by future releases of GCC. C++ code which relies on that macro to detect whether multi-threaded code is being compiled might change in meaning, possibly resulting in linker errors for single-threaded programs. At the moment a conversion of expensive divisions into cheaper operations has been implemented. In this scheme a whole file is parsed first and optimized later. The following basic inter-procedural optimizations are implemented: + Removal of unreachable functions and variables + Discovery of local functions (functions with static linkage whose address is never taken) + On i386, these local functions use register parameter passing conventions. Overall, the unit-at-a-time scheme produces a 13% improvement for the SPECint2000 benchmark on the i386 architecture (AMD Athlon CPU). The growth of large functions can now be limited via --param large-function-insns and --param large-function-growth. The old loop unroller still can be enabled by -fold-unroll-loops and may produce better code in some cases, especially when the webizer optimization pass is not run. The pass almost always improves code quality but does make debugging difficult and thus is not enabled by default by -O2 The pass is especially effective as cleanup after code duplication passes, such as the loop unroller or the tracer. New Languages and Language specific improvements Ada * The Ada front end has been updated to include numerous bug fixes and enhancements. Exception_Action) + New pragmas + New -gnatS switch replacing gnatpsta + Implementation of new Ada features (in particular limited with, limited aggregates) C/Objective-C/C++ * Precompiled headers are now supported. Precompiled headers can dramatically speed up compilation of some projects. There are some known defects in the current precompiled header implementation that will result in compiler crashes in relatively rare situations. Therefore, precompiled headers should be considered a "technology preview" in this release. Read the manual for details about how to use precompiled headers. GCC no longer gets confused by symlinks and hardlinks, and now has a correct implementation of #import and #pragma once. will not be accepted for C and Objective-C in a future version. A possible non-intrusive workaround is the following: (*(a, &b)) = 2; built-in functions such as __builtin_popcount for counting bits, finding the highest and lowest bit in a word, and parity have been added. The default input character set is taken from the current locale, and may be overridden with the -finput-charset command line option. In the future we will add support for inline encoding markers. C++ * G++ is now much closer to full conformance to the ISO/ANSI C++ standard. This means, among other things, that a lot of invalid constructs which used to be accepted in previous versions will now be rejected. It is very likely that existing C++ code will need to be fixed. The new parser contains much improved infrastructure needed for better parsing of C++ source codes, handling of extensions, and clean separation (where possible) between proper semantics analysis and parsing. The new parser fixes many bugs that were found in the old parser. This is needed because the name is dependent (in // this case, on template parameter T1). Here is the corrected definition of C<T>::h, template <typename T> void C<T>::h () { this->m = 0; template <int> struct A { static void bar(void){ foo('a'); So GCC used to accept the class name as argument of type template, and template template parameter. Now the name is not treated as a valid template template argument unless you qualify the name by its scope. For example, template <typename T> class C { friend void f<> (C&); You must first declare f as a template, template <typename T> void f; Previous versions of G++ used to be less strict about this and allowed friend declarations for private class members, for example. To avoid the error, you must move the declaration of g before the declaration of f The default arguments for g must be visible at the point where it is called. These changes are incorporated into the libstdc++ runtime library. This is better explained with an example: class A { public: void pub_func(); x, FreeBSD 5x, Solaris 27 and above, AIX 5x, Irix 65 * The allocator class is now standard-conformant, and two additional extension allocators have been added, mt_alloc and bitmap_allocator. Objective-C * The Objective-C front end has been updated to include the numerous bug fixes and enhancements previously available only in Apple's version of GCC. Options Controlling Objective-C Dialect for more information. The C99 _Bool and C++ bool type may now be encoded as 'B'. In addition, the back-end/codegen dependencies have been removed. Direct and indirect buffers work, as do fundamental file and socket operations. awt has been improved, though it is still not ready for general use. exec() handling and support for accented characters in filenames. This change is incompatible with previous GCC versions, but does fix compatibility with the Tru64 compiler and several corner cases where GCC was incompatible with itself. ARM * Nicolas Pitre has contributed his hand-coded floating-point support code for ARM. It is both significantly smaller and faster than the existing C-based implementation, even when building applications for Thumb. The arm-elf configuration has been converted to use the new code. Enabled at run time with the -mcpu=iwmmxt command line switch. This is similar to the arm-pe target, but it defaults to using the APCS32 ABI. Enabled at run time with the -mcpu=ep9312 command line switch. Note however that the multilibs to support this chip are currently disabled in gcc/config/arm/t-arm-elf, so if you want to enable their production you will have to uncomment the entries in that file. IA-32/AMD64 (x86-64) * Tuning for K8 (AMD Opteron/Athlon64) core is available via -march=k8 and -mcpu=k8. As a result it is not possible to call functions accepting vector arguments compiled by older GCC version. IA-64 * Tuning code for the Itanium 2 processor has been added. The generation of code tuned for Itanium 2 (option -mtune=itanium2) is enabled by default now. To generate code tuned for Itanium 1 the option -mtune=itanium1 should be used. DFA processor pipeline descriptions for the IA-64 processors have been added. This resulted in about 3% improvement on the SPECInt2000 benchmark for Itanium 2 * Instruction bundling for the IA-64 processors has been rewritten using the DFA pipeline hazard recognizer. It resulted in about 60% compiler speedup on the SPECInt2000 C programs. M32R * Support for the M32R/2 processor has been added by Renesas. Code generation for the ColdFire pr...