🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #2016

extern "C" bug

#2016
From: Gregg Whitcomb
Date: Fri, 19 May 1989 16:56
51 lines
1206 bytes
version: g++ 1.35.0
config: vax (ultrix 3.0)

problem: warning message "empty declaration" for structures
declared after a typedef.  Works okay if the typedef is moved after
the struct declaration.  Both test.cc and test.c run correctly regardless
of the error.

---------------------------------------

/* test.h */
typedef struct a A;
struct a 
   {
   int x;
   int y;
   int z;
   };


/* test.cc (warning message when compiled) */
#include <stream.h>
extern "C" 
{
#include "test.h"
}

main()
{
   struct a s;

   s.x  = 1;
   cout << s.x << "\n";
}


/* test.c  (works fine) */
#include <stdio.h>
#include "test.h"

main()
{
   struct a s;

   s.x  = 1;
   printf("%d\n",s.x);
}
---------------------------------------

-Gregg Whitcomb		whitcomb@ic.berkeley.edu
Technical Details
Message-ID: <8905191656.AA23244@eros.berkeley.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!EROS.BERKELEY.EDU!whitcomb

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!EROS.BERKELEY.EDU!whitcomb
From: whitcomb@EROS.BERKELEY.EDU (Gregg Whitcomb)
Newsgroups: gnu.g++.bug
Subject: extern "C" bug
Message-ID: <8905191656.AA23244@eros.berkeley.edu>
Date: 19 May 89 16:56:15 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 51