Args: var number & var types

Justin Chris Vallon jv0l+ at andrew.cmu.edu
Thu May 12 06:43:48 AEST 1988


Is there any way to declare a function to have two arguments point to the same
place in the stack-frame?  Let's say that I want to write the implementation of
foo which takes an optional argument based upon the first parameter:

{
  char c;
  int i;
  short s;
  long l;

  foo(0);     /* no optional argument */
  foo(1, c);  /* pass a character argument */
  foo(2, i);  /* pass an integer argument */
  foo(3, s);  /* pass a short arg */
  foo(4, l);  /* pass a long arg */
  foo(5, "Hello world"); /* pass a char* arg */
}

Could this be done?

-Justin
justin.vallon at andrew.cmu.edu



More information about the Comp.lang.c mailing list