cvs.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2002/11/25/18:53:24

Mailing-List: contact cygwin-developers-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT cygwin DOT com>
List-Help: <mailto:cygwin-developers-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-developers-owner AT cygwin DOT com
Delivered-To: mailing list cygwin-developers AT cygwin DOT com
Message-ID: <027401c294dd$65d31210$0201a8c0@sos>
From: "Sergey Okhapkin" <sos AT prospect DOT com DOT ru>
To: <cygwin-developers AT cygwin DOT com>
Subject: Is it a valid C++ structure initialization?
Date: Mon, 25 Nov 2002 18:50:10 -0500
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
X-Virus-Scanned: by amavisd-milter (http://amavis.org/)

Here is a test program (wich seems to me incorrect):

struct asd {
 int a;
 char b;
};

void f(int i, char c)
{
 struct asd qwe = {
  a: i,
  b: c
 };

}

The program compiles fine with gcc-3.2. Gcc 3.3 current snapshot reports:
test.cc: In function `void f(int, char)':
test.cc:11: error: too many initializers for `asd'

Solaris compiler complains:
$ CC -c test.cc
"test.cc", line 9: Error: a is not defined.
"test.cc", line 9: Error: Unexpected ":" found.
2 Error(s) detected.

The reason I'm asking about is that such kind of structure initialization is
used in cygwin sources (fhandler_socket::readv/writv, syscalls.cc
readv/writv, a whole bunch in wincap.cc). gcc 3.3 fails to build
cygwin1.dll. And I agree with the compiler. Removing "fieldname:" makes all
compilers happy.

Sergey Okhapkin
Somerset, NJ


- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019