+tru64

+tru64

This option causes return types of unprototyped functions to be treated as long, instead of int, matching Tru64 C behavior. This can prevent segfaults in +DD64 mode, resulting from pointer truncation, for instance:

long

*a;

 

long

sub() {

 

a

= malloc(sizeof(long));

/* no prototype! */

*a = 1234;

/* segfault if +DD64 and no +tru64 */

return *a;

 

}

 

 

A preferable solution is to provide the appropriate function prototypes.

NOTE: This option is applicable to C language only.

-Wc,-ansi_for_scope,[onoff]

-Wc,-ansi_for_scope,[onoff]

The -Wc,-ansi_for_scopeis option enables or disables the standard scoping rules for init declarations in for statements; the scope of the declaration then ends with the scope of the loop body. By default, the option is disabled.

Examples:

In the following example, if the option is not enabled (the current default), the scope of k extends to the end of the body of main and statement (1) is valid (and will return zero). With the option enabled, k is no longer in scope and (1) is an error.

#include <stdio.h>

int main() {

for (int k = 0; k!=100; ++k) { printf(“%d\n”, k);

}

return 100-k; // (1)

}

In the next example, with the option disabled, the code is illegal, because it redefines k in (2) when a previous definition (1) is considered to have occurred in the same scope.

With the option enabled (-Wc,-ansi_for_scope,on), the definition in (1) is no longer in scope at (2) and thus the definition in (2) is legal.

int main() { int sum = 0;

for (int k = 0; k!=100; ++k) // (1) sum += k;

for (int k = 100; k!= 0; ++k) // (2) sum += k;

}

-Wc,-koenig_lookup,[onoff]

-Wc,-koenig_lookup,[onoff]

The -WC,-koenig_lookupoption enables or disables standard argument-dependent lookup rules (also known as Koenig lookup). It causes functions to be looked up in the namespaces and classes associated with the types of the function-call argument. By default, the option is enabled.

Example:

In the following example, if the option is not enabled, the call in main does not consider declaration

(1)and selects (2). With the option enabled, both declarations are seen, and in this case overload resolution will select (1).

86 Command-Line Options