# 3.6. RTI Code Generator¶

The following issues affect backward compatibility in the Code Generator.

## 3.6.1. Removed -stl Option¶

The -stl command-line option has been removed because now it is the default behavior when running rtiddsgen. For more information, see Section 3.1.3.2.

## 3.6.2. Removed Support for -notypecode¶

rtiddsgen no longer supports the -notypecode option. If you try to use this option, code generation will fail with this error:

ERROR com.rti.ndds.nddsgen.Main Fail:  com.rti.ndds.nddsgen.Main\$ArgumentException: -notypecode is no longer supported.


In this release, type code information is always generated, but it is surrounded by:

#ifndef NDDS_STANDALONE_TYPE
#endif


When using standalone types, you already have to add the preprocessor definition NDDS_STANDALONE_TYPE. This definition now also leads to the exclusion of type code. For more information about how to use standalone types, see the “Using Generated Types without Connext DDS (Standalone)” section in the RTI Connext DDS Core Libraries User Manual.

## 3.6.3. Removed -use42eAlignment¶

rtiddsgen no longer supports the -use42eAlignment option. See Section 2.2.3 for more information.

## 3.6.4. Generated code for Extended CDR Encoding Version 2 (XCDR2)¶

RTI code generation now supports generating code for the Extended Common Data Representation (CDR) encoding version 2 (XCDR2), in addition to version 1 (XCDR). See Section 2.4.1 for more information.

## 3.6.5. Incorrect TypeCode name for member fields whose name was a keyword in Java¶

When generating the TypeCode name for members whose name was a keyword in Java, Code Generator added a _ as a prefix to that name. That could cause problems when communicating between a Java application and a C/C++/.Net application using that type because the types will not match out-of-the-box. For example:

struct MyType {
long class; /* class is a keyword in Java */
...
};


When generating Java code for the above type, Code Generator generated a TypeCode name _class for the member class.

That prefix has been removed in this release. That removal, however, could cause a backward compatibility problem when communicating between a Java application in 6.0.0 and one in a previous release, if the name of the members is a keyword in Java.

## 3.6.6. Modified maximum length of sequences and strings when -unboundedSupport is not used, when converting to XML¶

When Code Generator converted a type from IDL to XML, and that type contained an unbounded sequence, and -unboundedSupport was not used, the length of any sequence was -1. Now when -unboundedSupport is not used, the length of any unbounded sequence is 100, and the length of any unbounded string is 255. (When -unboundedSupport is used, the length of both is still -1.) These values (100 and 255) can be changed by using the options -sequenceSize and -stringSize.

If you generated XML in previous releases from an IDL containing unbounded sequences/strings, without using -unboundedSupport, you will have to regenerate the XML using the new Code Generator (without -unboundedSupport). This regeneration will put explicit (bound) limits on the sequences/strings. Otherwise, Connext DDS 6.0.0 will treat the sequences/strings defined in the XML as unbounded because of the change described in Section 2.4.4.

## 3.6.7. Traditional C++ compiled with -fno-exceptions¶

Starting in 5.3.0, the generated code for traditional C++ could not be compiled with the flag -fno-exceptions, producing an error similar to this one:

In file included from Hello.cxx:215:0:
rti_connext_dds-5.3.0/include/ndds/dds_c/generic/dds_c_sequence_TSeq.gen: In function ‘DDS_Boolean HelloSeq_set_maximum(HelloSeq*, DDS_Long)’:
rti_connext_dds-5.3.0/include/ndds/dds_c/generic/dds_c_sequence_TSeq.gen:548:32: error: exception handling disabled, use -fexceptions to enable


This issue has been resolved: the code will not report errors, provided that you generate code with the -allocateWithMalloc command-line option. This option disables the generation of default constructors/destructors and allocates the optional members using DDS_Heap_malloc.

## 3.6.8. Support for new, standard IDL, fixed-width integer types¶

This release introduces a new set of standard, fixed-width integer types to improve the readability of IDL files. These types are int16, int32, int64, uint16, uint32, and uint64, which are equivalent to the respective short, long, long long, unsigned short, unsigned long, and unsigned long long classic integer types. As a result, if you defined those types in your user IDL with typedefs, such as:

typedef long long int64;


Code Generator will fail to generate code, and you should remove the typedef from the IDL.

For the same reason, int8 and uint8, although not supported, cannot be used as part of the IDL, either.

## 3.6.9. Change in default optimization level for code generation¶

As described in “What’s New in 3.0.0” in the Code Generator Release Notes (in “New optimization level for code generation”), the default optimization level for code generation for C, C++, and Ada languages has changed from 0 to 2. This can increase the performance of the serialize/deserialize operations significantly in some cases. With optimization level 2, rtiddsgen optimizes the serialization/deserialization of structures and valuetypes by using more aggressive techniques, such as inline expansion of nested types or serialization of several consecutive members with a single copy (memcpy).

For additional information on this feature, see “Optimizing the Code Generation Process” in the RTI Code Generator User’s Manual.