🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2137

Preprocessor facilities

#2137
From: Hermann Stamm
Date: Fri, 16 Oct 1992 07:49
50 lines
1387 bytes
/*
Hello!

Is the below program ANSI-C conform?
It works with SUN-ANSI-C and gcc, 
and produces correctly the output:

132
213
321

It compiles without any warning and produces the
following messages concerning the usage of printf only with:

alint     --> function returns value which is always ignored
                  printf 

gcc -Wall --> warning: implicit declaration of function `printf'


Is the use of kl1 instead ) ok in the macro kac?
How to use kl0 if its ok ?

Bye,

   Hermann.
*/

#include <stdio.h>
#include <stdlib.h>

#define CAT(a,b)  a##b
#define XCAT(a,b) CAT(a,b)

#define kl0 (
#define kl1 )
#define k(n,a,b,c) XCAT(k,n)(a,b,c)
#define kbc(a,b,c) XCAT(a,XCAT(c,b))
#define kab(a,b,c) XCAT(b,XCAT(a,c))
#define kac(a,b,c) XCAT(c,XCAT(b,a)kl1


int main(void)
  {
  printf("%d\n",k(bc,1,2,3));
  printf("%d\n",k(ab,1,2,3));
  printf("%d\n",k(ac,1,2,3));

  return(0);
  }
Technical Details
Message-ID: <1992Oct16.074904.27806@olymp.informatik.uni-bonn.de>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!olymp!uran!hermann

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!olymp!uran!hermann
From: hermann@uran.informatik.uni-bonn.de (Hermann Stamm)
Subject: Preprocessor facilities
Message-ID: <1992Oct16.074904.27806@olymp.informatik.uni-bonn.de>
Sender: usenet@olymp.informatik.uni-bonn.de
Reply-To: hermann@uran.informatik.uni-bonn.de (Hermann Stamm)
Organization: Praktische Informatik III
Date: Fri, 16 Oct 1992 07:49:04 GMT
Lines: 52