🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4336

"Overloaded" function in C

#4336
From: Eric Lemings
Date: Mon, 06 Nov 1995 23:06
26 lines
803 bytes
Take a look at the following program:

#include <stdio.h>

#define f(x, y) ((x) / (y))

int (f)(int x, int y, int z)
  {
  return (x * y + z);
  }

int main(void)
  {
  int a = f(9, 2);
  int b = (f)(9, 2, 4);

  printf("f(9, 2) = %d", a);
  printf("(f)(9, 2, 4) = %d", b);

  return (0);
  }

Hunting season is now open.  I tried this on a Standard C/Unix
system compiler and it worked.  Not sure how useful it is though.

Eric Lemings
Technical Details
Message-ID: <47m4dl$eje@gaia.ns.utk.edu>
Path: arc1-ca.pugleaf.net!gaia.ns.utk.edu!unix1!elemings

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!gaia.ns.utk.edu!unix1!elemings
From: elemings@unix1.utm.edu (Eric Lemings)
Newsgroups: comp.std.c
Subject: "Overloaded" function in C
Date: 6 Nov 1995 23:06:29 GMT
Organization: University of Tennessee, Knoxville
Message-ID: <47m4dl$eje@gaia.ns.utk.edu>
NNTP-Posting-Host: unix1.utm.edu
X-Newsreader: TIN [version 1.2 PL2]