View Single Post
Old 10-02-2011, 11:33 AM
jpearman's Avatar
jpearman jpearman is offline
Senior Member
VEX # 8888
Join Date: Apr 2011
Location: Los Angeles
Posts: 3,970
RobotC programming tips

We've had thread like this before, however, though I would start a new one for RobotC programmers to post their tips and tricks.

To start it off here are a couple that may not be known.

functions can have default values for their parameters, for example.

/ pointless demo code

forward( int speed = 100 )
    motor[ port2 ] = speed;   

task main()
    // Forward at default
    forward( );
    // Forward at speed 10
    forward( 10 );
    // Do nothing
    while( true ){
If the function "forward" is called with no parameters then the default of 100 is used.

If you have included your own library of functions, for example.

#include "motorLib.c"
you can suppress warnings about unused functions by including the line
#pragma systemFile            // eliminates warning for "unreferenced" functions
in the top of that file
Reply With Quote