Author Topic: More on Alt+Comma (List Compatible Values)  (Read 7140 times)

Lisa

  • Senior Community Member
  • Posts: 238
  • Hero Points: 24
  • User-friendly geek-speak translator extraordinaire
More on Alt+Comma (List Compatible Values)
« on: May 01, 2008, 01:36:47 PM »
You can use Alt+Comma to list compatible values nearly anywhere in your code. This feature is not restricted to function parameter lists (see this thread).

For example:

Code: [Select]
double mysqrt(int i);
void main(int argc, char argv[])
{
   double dist;
   double area;
   int squares;
   int x,y,z;

   squares = x*x + y*y + z*z;

   dist = mysqrt( squares );
   area = (double) x*y*z;

   if ( dist >= area ) {
      printf("how about that, dist >= area");
   }
}

Go to the if statement, and put your cursor on "area", then press Alt+Comma. You will get a list of variables--either dist or area--both of which are compatible with the left-hand side of the expression, dist.
 
Go to "squares = ..." and put your cursor on "x", then press Alt+Comma. You will get a list of variables including squares, x, y, z, argc, and sizeof(), each of which is compatible with the left-hand side of the expression squares.
 
Go to "dist = mysqrt( ... )" and put your cursor on "squares", then press Alt+Comma. You will get both function parameter help for mysqrt() and a list of variables in the current scope which have integer type, as above.