🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Gregg Whitcomb Fri, 19 May 1989 16:56
extern "C" bug
#2016
Author: 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads