473,769 Members | 1,637 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

typedef forward declare

Hi,

With keyword struct, we can simply do forward declare by:

struct struct_a;

but if we typedef it:

typdef struct struct_a struct_a_t;

When we need to use struct_a_t but the cross include occurs, how to
tell compiler that struct_a_t is a type? seems like:

type struct_a_t;

Thanks.
ABAI
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
Dec 5 '06 #1
20 3140
Hi Binary(nice one ;) ),

Usually u wud declare the typedef part in a header
file,and include that header file in all the filese.When each file is
compiled,the header info gets included at preprocessing stage and hence
ur typedefnition.T hats how the complier would get to know about the
typedef as datatype.

cheers,
Kaushal.

Binary wrote:
Hi,

With keyword struct, we can simply do forward declare by:

struct struct_a;

but if we typedef it:

typdef struct struct_a struct_a_t;

When we need to use struct_a_t but the cross include occurs, how to
tell compiler that struct_a_t is a type? seems like:

type struct_a_t;

Thanks.
ABAI
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
Dec 15 '06 #2
krishna wrote:
Hi Binary(nice one ;) ),

Usually u wud
This is where I usually stop reading.
I can live with the occasional speling eror, I can live with the obvious
language Defizit, but kiddie talk in a technical newsgroup is unbearable.
I hope you never need to ask a question I could answer.
--
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
Dec 30 '06 #3
krishna wrote:
Hi Binary(nice one ;) ),

Usually u wud declare the typedef part in a header
file,and include that header file in all the filese.When each file is
compiled,the header info gets included at preprocessing stage and hence
ur typedefnition.T hats how the complier would get to know about the
typedef as datatype.

cheers,
Kaushal.

Binary wrote:
>Hi,

With keyword struct, we can simply do forward declare by:

struct struct_a;

but if we typedef it:

typdef struct struct_a struct_a_t;

When we need to use struct_a_t but the cross include occurs, how to
tell compiler that struct_a_t is a type? seems like:

type struct_a_t;

Thanks.
ABAI
--
comp.lang.c.mo derated - moderation address: cl**@plethora.n et -- you must
have an appropriate newsgroups line in your header for your mail to be
seen,
or the newsgroup name in square brackets in the subject line. Sorry.
Could I ask you to PLEASE refrain from text messaging on usenet? - its
infuriating to try and read.
Thanks,
Eric
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
Dec 30 '06 #4
In message <cl************ ****@plethora.n et>, Eric <No***@invalid. com>
writes
>Could I ask you to PLEASE refrain from text messaging on usenet? - its
infuriating to try and read.

And in particular it fails to appreciate the difficulties that the many
people who are not native English speakers have with it. Many of those
people are already struggling with reading and writing in a language
that is very different from their mother tongue and we should avoid
doing anything that makes it harder for them.
--
Francis Glassborow ACCU
Author of 'You Can Do It!'& 'You Can Program in C++'
see http://www.spellen.org/youcandoit
For project ideas and contributions: http://www.spellen.org/youcandoit/projects
Dec 30 '06 #5
On Sat, 30 Dec 2006 13:26:56 +0000,
Francis Glassborow <fr*****@robint on.demon.co.ukw rote:
>In message <cl************ ****@plethora.n et>, Eric <No***@invalid. com>
writes
>Could I ask you to PLEASE refrain from text messaging on usenet? -
its infuriating to try and read.

And in particular it fails to appreciate the difficulties that the
many people who are not native English speakers have with it. Many of
those people are already struggling with reading and writing in a
language that is very different from their mother tongue and we should
avoid doing anything that makes it harder for them.
Precisely!

You have my thanks, because I am one of the non-native English speakers
and writers who like lurking (and occasionally posting too) in clc :)

Jan 1 '07 #6
Josef Moellers wrote:
krishna wrote:
>Hi Binary(nice one ;) ),

Usually u wud

This is where I usually stop reading.
I can live with the occasional speling eror, I can live with
the obvious language Defizit, but kiddie talk in a technical
newsgroup is unbearable. I hope you never need to ask a
question I could answer.
Many stop even earlier, when they see the rude top-posting.

--
Merry Christmas, Happy Hanukah, Happy New Year
Joyeux Noel, Bonne Annee.
Chuck F (cbfalconer at maineline dot net)
<http://cbfalconer.home .att.net>
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
Jan 4 '07 #7
Hi,
Eric,Francis Glassborow,Gior gos Keramidas thank you for your
constructive criticism and pointing them out in lucid and soft
manner.Ill take care not to produce such difficulties for non english
speakers again.
Josef Moellers and CBFalconer ,thank you for not reading my post.I
found your criticisms 'quite' rude.One would appreciate if you both
would have adopted the manner the above members have guided.
With all due respects, and the spirit of C,
-Kaushal.

CBFalconer wrote:
Josef Moellers wrote:
krishna wrote:
Hi Binary(nice one ;) ),

Usually u wud
This is where I usually stop reading.
I can live with the occasional speling eror, I can live with
the obvious language Defizit, but kiddie talk in a technical
newsgroup is unbearable. I hope you never need to ask a
question I could answer.

Many stop even earlier, when they see the rude top-posting.

--
Merry Christmas, Happy Hanukah, Happy New Year
Joyeux Noel, Bonne Annee.
Chuck F (cbfalconer at maineline dot net)
<http://cbfalconer.home .att.net>
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
Jan 10 '07 #8
krishna wrote:
>
Eric,Francis Glassborow,Gior gos Keramidas thank you for your
constructive criticism and pointing them out in lucid and soft
manner.Ill take care not to produce such difficulties for non
english speakers again.
Josef Moellers and CBFalconer ,thank you for not reading my
post.I found your criticisms 'quite' rude.One would appreciate if
you both would have adopted the manner the above members have
guided. With all due respects, and the spirit of C,
Well, you appear to be uneducable, since you persist in rude
top-posting. Whether that is innate stupidity or bad manners is
not yet known. You are also persisting in excessive cross-posting,
which is another indication of foolishness. Follow-ups set.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home .att.net>
--
comp.lang.c.mod erated - moderation address: cl**@plethora.n et -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
Jan 20 '07 #9
CBFalconer wrote:
krishna wrote:
> Eric,Francis Glassborow,Gior gos Keramidas thank you for your
constructive criticism and pointing them out in lucid and soft
manner.Ill take care not to produce such difficulties for non
english speakers again.
Josef Moellers and CBFalconer ,thank you for not reading my
post.I found your criticisms 'quite' rude.One would appreciate if
you both would have adopted the manner the above members have
guided. With all due respects, and the spirit of C,

Well, you appear to be uneducable, since you persist in rude
top-posting. Whether that is innate stupidity or bad manners is
not yet known. You are also persisting in excessive cross-posting,
which is another indication of foolishness. Follow-ups set.
Calling a man fool because he cross-posts is not exactly good
manners for sure. And calling a man fool because of top-posting
is way more foolish than top-posting itself. Do you know that
many people top-post in real email communication, just because
they do so and it's perfectly acceptable in their communities?
Some people even find it hard to read proper quote-and-reply
stuff.

Yes, top-posting is bad here. No, calling people fools for top-posting
is no freaking good, even if silently acceptable. Some may say you're
keeping this newsgroup clean, whatever, some people say shooting people
is a good way to teach them good manners too.

Yevgen
Jan 21 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3652
by: Vikas | last post by:
I have a header file say A.h in which I have typedefed typedef std::vector<std::string> StringVector; Now there is second file say B.h in which a class B has a method class B { .... ParseData(const StringVector::const_iterator& begin, const StringVector::const_iterator& end);
11
3904
by: Jacek Dziedzic | last post by:
Hello! I'm creating a class that has a static method which would compute a lookup table needed later by all members of the class. The problem is, the lookup table is composed of records and one of the record fields is the class itself, i.e. I'm aiming at something like: typedef struct { my_class instance;
5
506
by: Jordi Vilar | last post by:
Hi all, Is it possible to do a forward declaration for a typedef of an incomplete anonymous struct? for example, if I have a type declared (in a 3rd part header file that I cannot modify) as: typedef struct { ... } mytype;
2
4521
by: Plok Plokowitsch | last post by:
After over a decade of programming in C++ I seem to have missed some substantial point (mental note: am I getting too old for this?). A little bit of help would be *very* appreciated. I'm trying to gather various different classes into a common namespace using typedefs: class QWidget {}; class MyListview {}; namespace gui
4
13256
by: Martin Vorbrodt | last post by:
why would you bother writing: typedef struct S { } S_t; instead of just: struct S { };
16
3844
by: burn | last post by:
Hello, i am writing a program under linux in c and compile my code with make and gcc. Now i have 4 files: init.c/h and packets.c/h. Each header-file contains some: init.h: struct xyz {
7
15297
by: Michael B Allen | last post by:
I have a forward reference like: struct foo; int some_fn(struct foo *param); Because the parameter is a pointer the compiler is satisfied. But now I wan to change 'struct foo' to a typedef'd type like 'foo_t'. The following all fail to compile:
7
4718
by: for.fun | last post by:
Hi everybody, I have the following problem : B class need A::MyEnum type and A class need B::MyEnum type. In both case, the class type is incomplete so it is obvious that the ::MyEnum can not be found in the class definition (the compiler complains) My problem is the MyEnum types have to be defined inside the class
8
28469
by: Mohammad Omer Nasir | last post by:
Hi, i made a structure in header file "commonstructs.h" is: typedef struct A { int i; A( ) {
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9994
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8870
agi2029
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...
1
7408
isladogs
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...
0
5298
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...
1
3958
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
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.