.NET 2003 (wntmsci10)

Contents

General

1. New compiler switches

2. Breaking Changes

3. Nonstandard behavior
4. Miscellaneous

Office build
1. Size and performance .NET 2003 vs. .NET 2002 build

2. Required code changes

General

1. New compiler switches1)

/GS
The /GS option detects some buffer overruns, which overwrite the return address. It has been enhanced to help protect local variables from direct buffer overruns. This is achieved by injecting security checks into the compiled code.

/G7
Optimize code for Pentium 4 (may be result in slower code for other Pentium processors).
5-10% reduction in execution time may be possible.

/arch
The compiler supports generation of code using the Streaming SIMD Extensions (SSE) and Streaming SIMD Extensions 2 (SSE2) instructions. The SSE instructions exist in various Pentium processors as well as in AMD Athlon processors. The SSE2 instructions currently only exists on the Pentium 4 processor. Performance improvements vary widely, but are in the range of 2-3%.

2. Breaking Changes1)
This topic summarizes the compile-time errors and warnings that will now be issued on code that compiled without errors or warnings in Visual Studio .NET or earlier versions.

Closing parentheses now required for the defined preprocessor directive (C2004).

Explicit specializations no longer find template parameters from primary template (C2146).

A protected member (n) can only be accessed through a member function of a class (B) that inherits from the class (A) of which it (n) is a member (C2247).

Improved accessibility checks in compiler now detect inaccessible base classes (C2248).

An exception cannot be caught if the destructor and/or copy constructor is inaccessible (C2316).

Default arguments on pointers to functions no longer allowed (C2383).

A static data member cannot be initialized via derived class (C2477).

The initialization of a typedef is not allowed by the standard and now generates a compiler error (C2513).

bool is now a proper type (C2632).

A UDC can now create ambiguity with overloaded operators (C2666).

More expressions are now considered valid null pointer constants (C2668).

template<> is now required in places where the compiler would previously imply it (C2768).

The expilicit specialization of a member function ourside the class is not valid if the function has already been explicitly specialized via a template class specialization. (C2910).

Floating point non-type template parameters are no longer allowed (C2993).

Class templates are not allowed as template type arguments (C3206).

Friend function names are no longer introduced into containing namespace (C3767).

The compiler will no longer accept extra commas in a macro (C4002).

An object of POD type constructed with an initializer of the form () will be default-initialized (C4345).

typename is now required if a dependent name is to be treated as a type (C4346).

Functions that were incorrectly considered template specializations are no longer considered so (C4347).

Static data members cannot be initialized via derived class (C4356).

A class template specialization needs to be defined before it was used in a return type (C4686).

The compiler now reports unreachable code (C4702).

3.Nonstandard behavior1)

Nesting levels of compound statements, iteration control structures, and selection control structures [256] (247).

Parameters in one macro definition [256] (127).

Arguments in one macro invocation [256] (127).

Characters in a character string literal or wide string literal (after concatenation) [65536] (65535).

Levels of nested class, structure, or union definitions in a single struct-declaration-list [256] (16).

Member initializers in a constructor definition [6144] (approximately 600, memory dependent, can increase with the /Zm compiler option).

Scope qualifications of one identifier [256] (127).

Nested external specifications [1024] (10).

Template arguments in a template declaration [1024] (64).

Virtual base classes are not supported as covariant return types.

The export keyword is not supported on templates. For example, the following sample will not compile:

export template <class T> void fun(T);

export template <class T> class A;

The Visual C++ compiler does not currently support binding nondependent names when initially parsing a template. This can cause overloads to be declared after the template (but before the template is instantiated) to be seen.

// DependentNames.cpp

#include <stdio.h>

namespace N {

void f(int) { printf("f(int)\n");}

}

template <class T> void g(T) {

N::f('a'); // calls f(char) should call f(int)

}

namespace N {

void f(char) { printf("f(char)\n");}

}

int main() {

g('c');

}

Function exception specifiers other than throw() are parsed but not used. For example:

void f() throw(int); // parsed but not used

void g() throw(); // parsed and used

Function uncaught_exception always returns false even in cases where the standard specifies that it should return true.

Microsoft Specific

The compiler cannot instantiate a template outside of the module in which it is	defined.

Templates cannot be used with functions declared with __declspec (dllimport) or __declspec	(dllexport).

All template arguments must be of an unambiguous type that exactly matches that of the template parameter list. For example:

template< class T > T check( T );

template< class S > void watch( int (*)(S) );

watch( check ); //error

The compiler should instantiate the check templated function in the form int check( int ), but the inference cannot be followed.

Friend functions must be declared before they are used in a templated class. You cannot have a friend function defined within a class definition. This is because the friend function could be a templated function, which would cause an illegal nested template definition.

Miscellaneous

*.sln and *.vcproj files aren't downwards compatible to .NET 2002

New Framework 1.1

msvcr71.dll, msvcp71.dll

II. Building StarOffice

1. Size and performance .NET 2003 vs. .NET 2002 build

The build was performed without /GS, /arch and /G7 switches.

Size of installationsets decreased by only 80KB (0,07 %) than a build with .NET2002

Startup performance:

NET	Start-up Time [s]	Ø [s]	σ [s]
2002	1,45	1,44	1,49	1,50	1,68	1,43	1,50	0,09
2003	1,50	1,57	1,37	1,34	1,33	1,48	1,43	0,10

Required code changes

AddIn ConvertDSW for automatic builds of berkeleydb, icu and python has to be changed.

Template types have to be declared as typename.
E.g. (from ucb/source/inc/regexpmap.tpt ):

Old:
template< typename Val >
RegexpMap< Val >::iterator RegexpMap< Val >::begin()
New:
template< typename Val >

typename RegexpMap< Val >::iterator RegexpMap< Val >::begin()

friend functions implemented in a class and used
E. g. configmgr\source\api2\broadcaster.cxx
error C3767: 'equalTreeRef' matching function is not accessible
class bla{
...
friend inline bool equalTreeRef(TreeRef const& lhs, TreeRef const& rhs)
{ return lhs.m_pImpl == rhs.m_pImpl; }
};
ok:
class bla{
...
friend inline bool equalTreeRef(TreeRef const& lhs, TreeRef const& rhs);
};
inline bool equalTreeRef(TreeRef const& lhs, TreeRef const& rhs)
{ return lhs.m_pImpl == rhs.m_pImpl; }

Parse problems with this construct:

void NotifyStatusChanged(const ::com::sun::star::util::URL& aUrl, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xControl = ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > ());
fixed by:
typedef ::com::sun::star::frame::XStatusListener xstlist_type;

typedef ::com::sun::star::uno::Reference< xstlist_type > xlistener_type;

void NotifyStatusChanged(const ::com::sun::star::util::URL& aUrl, const xlistener_type & xControl = xlistener_type() );

Old:
struct std::hash< SfxConfigManager* >

New:

template<> struct std::hash< SfxConfigManager* >

Castings required to solve ambiguous function calls.

Example from configmgr (one file only in the hole office source) where the new compiler has a problem with default initializing.The compiler gives a misleading error message that OEnum is not declared.
E.g. configmgr/source/xml/elementinfo.hxx

namespace x

{

namespace ET

{

enum TEnum

{

unknown,

schema

};

}

namespace OP

{

enum OEnum

{

none,

unknown

};

}

struct ElementInfo

{

explicit

ElementInfo(ET::TEnum _type = ET::unknown)

: type(_type),

// op(); //ERROR: OEnum not defined

op(OP::none); //works fine.

{}

ET::TEnum type;

OP::OEnum op;

};

};

Bibliography

1) Microsoft Visual Studio .NET Documentation

2003-08-08T09:37:31