Package Index  Table of Contents

CodeCheck ECS C/C++ to Test Suite - 88.cpp

/*
88.    Use inline functions instead of macros.
*/
#define _SQRT(x) sqrt(x)



Function Name: SQRT()

inline double SQRT(int x) {
return ( sqrt(x) );
}



Function Name: main()

main() {
  
double hypo;
  hypo = _SQRT ( 2 );  // BAD 88, don't use macros
  
  hypo = SQRT ( 2 );    // GOOD 88, inline 
  
}

Package Index  Table of Contents

CodeCheck Copyright (c) 1988-2005 by Abraxas Software Inc. (R). All rights reserved.