auto specifier
The auto specifier is a C++11 language feature. When used for variables and return types, the auto keyword specifies that the type will be deduced by the compiler.
Role and benefits
The auto specifier is described as a useful feature that improves the readability and maintainability of code by removing the need to spell out types explicitly, letting the compiler infer them from the initializing expression or return statement.
Use in SGen
In the SGen sequence-based stimulus engine for microprocessor verification, the auto specifier is listed among the key C++11 features that made the implementation viable. It appears in a working code example in section II.B of the SGen paper, demonstrating its practical use in the codebase. It sits alongside other C++11 enablers used by SGen:
- Lambda functions
- Improved random number generation libraries (used to build SGen's
weighted_setclass) - Polymorphic function wrapper (
std::function) for storing references to callable objects - Regular expressions from the standard library
Related concept: SGen
SGen is a C++11 sequence-based stimulus engine for microprocessor verification. It piggybacks onto the directed mode of the underlying PPIGen tool and relies on several C++11 features, including the auto specifier, to keep the sequence-based stimulus code readable and maintainable.