Oracle® Solaris Studio 12.4: IDE Quick Start Tutorial

Exit Print View

Updated: October 2014
 
 

Using Code Templates

The Source Editor has a set of customizable code templates for common snippets of C, C++, and Fortran code. You can generate the full code snippet by typing its abbreviation and pressing the Tab key. For example, in the quote.cc file of the Quote_1 project:

  • Type uns followed by a tab and uns expands to unsigned.

  • Type iff followed by a tab and iff expands to if (exp) {}.

  • Type ifs followed by a tab and ifs expands to if (exp) {} else {}.

  • Type fori followed by a tab and fori expands to for (int i=0; i< size; i++) { Object size = array[i]; }.

    To see all of the available code templates, modify them, create your own code templates, or select a different key to expanded the templates:

  1. Choose Tools > Options.

  2. In the Options dialog box, select C/C++, and click the Code Templates tab.

  3. Select a language from the Language drop-down list.

  4. Add or remove items using the New or Remove buttons. You can also edit current templates in the Expanded Text tab or add a description of the template in the Description tab.

    image:Code Templates tab in Options dialog box