Hi All,
Is it valid:
struct test{
};
I mean, Can we have a struct containing no members? Is this a an
incomplete-type?
Please provide your expert comments.
Thanks,
Raman Chalotra 10 2258
On Jun 6, 2:32 pm, Raman <ramanchalo...@ gmail.comwrote:
Hi All,
Is it valid:
struct test{
};
I mean, Can we have a struct containing no members? Is this a an
incomplete-type?
Please provide your expert comments.
Thanks,
Raman Chalotra
I don't see anything wrong with the declaration. Though this stuff
does not look like it can have any practical applications.
The standard does not mandate declaring a member in a structure. This
code compiles with '-ansi' flag on Linux/gcc.
I don't see any reason why it should not be valid.
rahul <ra*********@gm ail.comwrites:
On Jun 6, 2:32 pm, Raman <ramanchalo...@ gmail.comwrote:
<snip>
>struct test{
};
I mean, Can we have a struct containing no members? Is this a an incomplete-type?
Please provide your expert comments.
Thanks, Raman Chalotra
I don't see anything wrong with the declaration. Though this stuff
does not look like it can have any practical applications.
The standard does not mandate declaring a member in a structure.
My copy does. The syntax specifies that there must be at least one
member. Where are you getting your information from?
This
code compiles with '-ansi' flag on Linux/gcc.
Add -pedantic.
I don't see any reason why it should not be valid.
--
Ben.
rahul wrote:
On Jun 6, 2:32 pm, Raman <ramanchalo...@ gmail.comwrote:
>Hi All,
Is it valid:
struct test{
};
I mean, Can we have a struct containing no members?
No.
>Is this a an incomplete-type?
No.
>Please provide your expert comments.
Thanks, Raman Chalotra
I don't see anything wrong with the declaration.
Then you need to look at the standard more carefully:
6.7.2.1 Structure and union specifiers
Syntax
1 struct-or-union-specifier:
struct-or-union identifieropt { struct-declaration-list }
struct-or-union identifier
struct-or-union:
struct
union
struct-declaration-list:
struct-declaration
struct-declaration-list struct-declaration
Note that a struct-declaration-list ALWAYS has a struct-declaration!
Though this stuff
does not look like it can have any practical applications.
The standard does not mandate declaring a member in a structure.
Wrong. From N1256:
This
code compiles with '-ansi' flag on Linux/gcc.
That does not make it procude all required diagnostics. You need '-ansi
-pedantic' at which point it gives a warning. Note that a warning is
sufficient to meet the standards requirement for "invalid" code (a puch
in the face could also qualify, but I don't think an implementation that
did this would be very popular)
I don't see any reason why it should not be valid.
See above.
An imcomplete type would be
struct test;
--
Flash Gordon
On Jun 6, 2:51*pm, rahul <rahulsin...@gm ail.comwrote:
On Jun 6, 2:32 pm, Raman <ramanchalo...@ gmail.comwrote:
Hi All,
Is it valid:
struct test{
};
I mean, Can we have a struct containing no members? Is this a an
incomplete-type?
Please provide your expert comments.
Thanks,
Raman Chalotra
I don't see anything wrong with the declaration. Though this stuff
does not look like it can have any practical applications.
The standard does not mandate declaring a member in a structure. This
code compiles with '-ansi' flag on Linux/gcc.
I don't see any reason why it should not be valid.
hey i dont find ne thng wrong in ur problem........ ..bt surely this
thng cannot b realised in practical situation...... rest its ok.tk cr
bye
On Fri, 6 Jun 2008 06:45:27 -0700 (PDT), muks <mu********@gma il.com>
wrote in comp.lang.c:
On Jun 6, 2:51*pm, rahul <rahulsin...@gm ail.comwrote:
On Jun 6, 2:32 pm, Raman <ramanchalo...@ gmail.comwrote:
Hi All,
Is it valid:
struct test{
};
I mean, Can we have a struct containing no members? Is this a an
incomplete-type?
Please provide your expert comments.
Thanks,
Raman Chalotra
I don't see anything wrong with the declaration. Though this stuff
does not look like it can have any practical applications.
The standard does not mandate declaring a member in a structure. This
code compiles with '-ansi' flag on Linux/gcc.
I don't see any reason why it should not be valid.
hey i dont find ne thng wrong in ur problem........ ..bt surely this
thng cannot b realised in practical situation...... rest its ok.tk cr
bye
hey ur a fkng mron.
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.l earn.c-c++ http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
"muks" <mu********@gma il.comwrote in message
news:d9******** *************** ***********@a32 g2000prf.google groups.com...
[...]
hey i dont find ne thng wrong in ur problem........ ..bt surely this
thng cannot b realised in practical situation...... rest its ok.tk cr
bye
:^/
>hey i dont find ne thng wrong in ur problem........ ..bt surely this thng cannot b realised in practical situation...... rest its ok.tk cr bye
I have seen #defines that turn on and off structure members to save memory,
and one even turned all the members off.
rahul wrote:
On Jun 6, 2:32 pm, Raman <ramanchalo...@ gmail.comwrote:
>Hi All,
Is it valid:
struct test{
};
I mean, Can we have a struct containing no members? Is this a an incomplete-type?
Please provide your expert comments.
Thanks, Raman Chalotra
I don't see anything wrong with the declaration. Though this stuff
does not look like it can have any practical applications.
The standard does not mandate declaring a member in a structure. This
code compiles with '-ansi' flag on Linux/gcc.
I don't see any reason why it should not be valid.
Are you sure you weren't compiling as C++?
--
Ian Collins.
On Jun 6, 4:56 pm, Flash Gordon <s...@flash-gordon.me.ukwro te:
rahul wrote:
On Jun 6, 2:32 pm, Raman <ramanchalo...@ gmail.comwrote:
Hi All,
Is it valid:
struct test{
};
I mean, Can we have a struct containing no members?
No.
Is this a an
incomplete-type?
No.
Please provide your expert comments.
Thanks,
Raman Chalotra
I don't see anything wrong with the declaration.
Then you need to look at the standard more carefully:
6.7.2.1 Structure and union specifiers
Syntax
1 struct-or-union-specifier:
struct-or-union identifieropt { struct-declaration-list }
struct-or-union identifier
struct-or-union:
struct
union
struct-declaration-list:
struct-declaration
struct-declaration-list struct-declaration
Note that a struct-declaration-list ALWAYS has a struct-declaration!
Though this stuff
does not look like it can have any practical applications.
The standard does not mandate declaring a member in a structure.
Wrong. From N1256:
This
code compiles with '-ansi' flag on Linux/gcc.
That does not make it procude all required diagnostics. You need '-ansi
-pedantic' at which point it gives a warning. Note that a warning is
sufficient to meet the standards requirement for "invalid" code (a puch
in the face could also qualify, but I don't think an implementation that
did this would be very popular)
I don't see any reason why it should not be valid.
See above.
An imcomplete type would be
struct test;
--
Flash Gordon
HI,
Yes, and
1. we cant apply sizeof to incomplete types.
2. what if we create array of this struct(incomple te), every element
having same mem address....whic h is probably violation of array
concept in itself.
Thanks,
Raman Chalotra This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Gianni Mariani |
last post by:
The 3 compilers I tried all did different things.
gcc 3.4.0 ICE's (Bug 15480)
MS C++ 7.1 has meaningless diags
Comeau accepts the code
Obviously this is not somthing I'll be using until we get the compilers
doing the right thing, but I do want to report the appropriate errors.
BTW, I think the code is valid. It does the thing I was trying to do
|
by: Dan |
last post by:
I'm trying to creat a data structure, that can be either a integer,
double, string, or linked list. So I created the following, but don't
know if it is the data structure itself causing problems, or something
I am doing in the rest of the program.
This is the data structure.
struct node
{
char type;
|
by: Russell Shaw |
last post by:
Hi,
I have two structs in a header file, and they reference each other,
causing a compile error. Is there a standard way to deal with this?
typedef struct {
...
RtAction *actions;
} RtWidget;
|
by: Martijn van Buul |
last post by:
Hi,
Today, I stumbled over the following:
I had a struct, whose scope only made sense within a single function, and I
wanted to use std::swap() on it, like the following example:
#include <algorithm>
void somefunction()
|
by: Lane Straatman |
last post by:
I would like to write a 'struct'. I have a library that is all but
completely inappropriate for this task.
So I'm looking for C code that fills in the gaps between:
#undef whateverkeithsaysfor99compliance
#define whateverkeithsays for99compliance
int main(void
{
struct foo
| |
by: Laurent Deniau |
last post by:
I would like to know why the following small program does not compile
(checked with gcc 4.1.2) and if the compiler behavior is correct:
struct A;
typedef void (T)(struct A*);
void f(void) {
struct A { int _; } a;
((T*)0)(&a);
|
by: Boris |
last post by:
Is this a valid C++ program (according to the C++ standard)? I ask as I'm
trying to port a Windows library to Solaris, and the Solaris C++ compiler
reports an error (The name x is ambiguous in ns1: ns2::x and ns1::x). The
code below reproduces the problem, and I wonder now if I have to adapt the
code or submit a bug report to Sun?
namespace ns1 {
struct x { };
}
|
by: beet |
last post by:
Hi all,
I tried to declare a c++ struct like following in a header file; I
want to include
this header file in other files to create and access this struct.
------
1 #ifndef _SEARCHDATA_H_
2 #define _SEARCHDATA_H_
3
|
by: rn |
last post by:
the code below compiles OK with gcc 4.0 but not with gcc.4.2 and visual
studio 2005 (ver 8 ).
to me it seems it should not compile.
-----
class test1
{
public:
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |