Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In this example, void is explicitly specified as a parameter. If the caller calls foo(3) again, a warning message will be issued as follows:

Code Block
bgColor#FFCCCC

error: too many arguments to function ‘foo’

Because it is an error message, the programmer can not ignore it and thus previous belief regarding the interface can be rectified.

Noncompliant Code Example (information outflow)

Code Block
bgColor#FFCCCC
/* compile using gcc4.3.3 */
void foo () {
    /* use asm code to retrieve i 
     * implicitly from caller 
     * and transfer it to a less privilege file */
}

...

/* caller */
    foo(i); /* i is fed from user input */

...