Dear All
What does exactly below code means
struct File
{
void* data;
};
typedef struct File File;
typedef File* fl;
And thanks to Jaspreet and SM Ryan for the clarifying my previous
querry.
Thanks In advance
Ranjeet 13 2159 ra***********@gmail.com wrote: Dear All
What does exactly below code means
struct File { void* data;
Declaring a pointer of type void so that it can then be typecast to any
data type. Consider this as a Joker in a game of cards. You are not
sure right now what all type could the data be.
}; typedef struct File File; typedef File* fl;
And thanks to Jaspreet and SM Ryan for the clarifying my previous querry.
Thanks In advance Ranjeet ra***********@gmail.com wrote: Dear All
What does exactly below code means
struct File { void* data; };
This declares `struct File' as the type of a struct that
contains one element named `data' whose type is "pointer to
`void'."
typedef struct File File;
This declares `File' as an alias for `struct File'.
typedef File* fl;
This declares `fl' as an alias for `File*', that is,
as an alias for `struct File*'.
-- Er*********@sun.com
Eric Sosman wrote: ra***********@gmail.com wrote: Dear All
What does exactly below code means
struct File { void* data; };
This declares `struct File' as the type of a struct that contains one element named `data' whose type is "pointer to `void'."
A void * pointer isn't a pointer to a void object, its a pointer to any
object. Its just that you dont know what type of object its pointing
to! A discussion on this topic was already carried out in the thread:
"void *malloc(size_t num_bytes);" started by Alawna on Jun 19. (This
particular discussion appears towards the end of the thread). Besides,
what do you mean by 'pointer to void'?
forayer
Eric Sosman wrote: ra***********@gmail.com wrote: Dear All
What does exactly below code means
struct File { void* data; }; This declares `struct File' as the type of a struct that contains one element named `data' whose type is "pointer to `void'."
typedef struct File File;
This declares `File' as an alias for `struct File'.
typedef File* fl;
This declares `fl' as an alias for `File*', that is, as an alias for `struct File*'.
Eric Do you mean that "fl" as an alias of the File Pointer,
menas that it is alias to the strcut File *(pointer),
Pointer to the file which is of struct type is named as "fl" -- Er*********@sun.com
ranjeet.gu...@gmail.com wrote: Eric Sosman wrote: typedef struct File File;
This declares `File' as an alias for `struct File'.
typedef File* fl;
This declares `fl' as an alias for `File*', that is, as an alias for `struct File*'.
Eric Do you mean that "fl" as an alias of the File Pointer, menas that it is alias to the strcut File *(pointer),
Pointer to the file which is of struct type is named as "fl"
This should make it a bit more clearer (given the typedefs):
File f; // is equivalent to declaring it as "struct File f"
f1 g; // is equivalent to declaring it as "File *g"
// but since declaring "File <anything>" is
// similar to declaring it as "struct File <anything>",
// "f1 g" is also equivalent to "struct File *g"
Hope this helps.
cheers,
forayer]
forayer wrote: Eric Sosman wrote:
ra***********@gmail.com wrote:
Dear All
What does exactly below code means
struct File { void* data; }; This declares `struct File' as the type of a struct that contains one element named `data' whose type is "pointer to `void'."
A void * pointer isn't a pointer to a void object,
I did not say that it was. There is no such thing as
a `void' object.
its a pointer to any object. Its just that you dont know what type of object its pointing to! A discussion on this topic was already carried out in the thread: "void *malloc(size_t num_bytes);" started by Alawna on Jun 19. (This particular discussion appears towards the end of the thread). Besides, what do you mean by 'pointer to void'?
`void' is a type. It happens to be an incomplete type
with the special property that it can never be completed.
Given any type T, complete or incomplete, it is always
possible to derive a new "pointer to T" type denoted `T*'.
(One may eventually encounter compiler limitations on the
number of levels of indirection permitted -- it might not
be possible to use an `int******************************',
for example -- but these are implementation artifacts and
not characteristics of the language.) In particular, there
is a type `void' and so it is possible to derive a "pointer
to `void'" type denoted `void*'.
The Standard contains a few special guarantees about the
`void*' type, and these make it useful as a sort of "type-
blind" pointer. You can't do much with a `void*' as it
stands (you can compare it to other pointer values, but
that's about it), but you can convert it to some other data
pointer type and make use of the converted value (if valid).
-- Er*********@sun.com ra***********@gmail.com wrote: Eric Sosman wrote:
ra***********@gmail.com wrote:
Dear All
What does exactly below code means
struct File { void* data; };
This declares `struct File' as the type of a struct that contains one element named `data' whose type is "pointer to `void'."
typedef struct File File;
This declares `File' as an alias for `struct File'.
typedef File* fl;
This declares `fl' as an alias for `File*', that is, as an alias for `struct File*'.
Eric Do you mean that "fl" as an alias of the File Pointer, menas that it is alias to the strcut File *(pointer),
Pointer to the file which is of struct type is named as "fl"
Yes. Given these definitions, all the following
fragments are equivalent:
struct File s;
struct File *p = &s;
File s;
File *p = &s;
File s;
fl p = &s;
struct File s;
fl p = &s;
-- Er*********@sun.com ra***********@gmail.com wrote: Dear All
What does exactly below code means
struct File { void* data; }; typedef struct File File; typedef File* fl;
And thanks to Jaspreet and SM Ryan for the clarifying my previous querry.
Thanks In advance Ranjeet
Compare with this structuring, which is easier to read and does the same
thing:
typedef struct File {
void *data;
} File, *fl;
The type of "File" is "struct File".
The type of "fl" is "pointer to a 'struct File'"
--
Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Technical Architect, Common User Interface Services
M/S 2R-94 (206)544-5225
#! rnews 1533
Xref: xyzzy rec.models.rockets:559284
Newsgroups: rec.models.rockets
Path: xyzzy!nntp
From: WallaceF <fr*********@boe.com>
Subject: Re: Court records are SUCH fun....
X-Nntp-Posting-Host: pex003155.se.nos.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <42***************@boe.com>
Sender: nn**@news.boeing.com (Boeing NNTP News Access)
Content-Transfer-Encoding: 7bit
Organization: The Boeing Company
X-Accept-Language: en
References: <2bque.17994$FP2.649@lakeread03> <d1********************************@4ax.com>
Mime-Version: 1.0
Date: Thu, 23 Jun 2005 15:10:17 GMT
X-Mailer: Mozilla 4.79 [en]C-CCK-MCD Boeing Kit (Windows NT 5.0; U)
Phil Stein wrote: On Wed, 22 Jun 2005 22:40:39 -0500, Kevin Trojanowski <tr**@nospam.cox.net> wrote:
http://170.164.50.60/openaccess/crim...nbr=75199&dsn=
Or, for those of you who like 'em shorter....
http://tinyurl.com/d9m62
-Kevin
In this one from 2000 Skippy seems to have hijacked a 1979 Honda. Nice taste. 8-) http://170.164.50.60/openaccess/civi...RN+OVER+ORDER+
Hey Jerry, How's biz? If it's good, maybe you can move up to an 85 model.
Shure hope JI involvement with Xavien does not cause problems for a
manufacture of some preaty darn good products.
Eric Sosman wrote: ra***********@gmail.com wrote: Eric Sosman wrote:
ra***********@gmail.com wrote:
Dear All
What does exactly below code means
struct File { void* data; };
This declares `struct File' as the type of a struct that contains one element named `data' whose type is "pointer to `void'."
typedef struct File File;
This declares `File' as an alias for `struct File'.
typedef File* fl;
This declares `fl' as an alias for `File*', that is, as an alias for `struct File*'.
Eric Do you mean that "fl" as an alias of the File Pointer, menas that it is alias to the strcut File *(pointer),
Pointer to the file which is of struct type is named as "fl"
Yes. Given these definitions, all the following fragments are equivalent:
struct File s; struct File *p = &s;
File s; File *p = &s;
File s; fl p = &s;
struct File s; fl p = &s;
Thanks to you forver and eric, I got cleared, But have one doubt
in other issue i.e
Below is the code which I find in the Source code
struct FileRecord
{
void *data;
};
typedef struct FileRecord FileRecord;
typedef FileRecord* flReader;
Now I think the above is same as what i understood so I am
writting the code.
typedef struct
{
void *data;
}FileRecord;
typedef FileRecord* flReader;
IF above is correct then it means I understood correctly,
Please bear with me as I dont have the compiler at present.
-- Er*********@sun.com
Eric Sosman wrote: ra***********@gmail.com wrote: Eric Sosman wrote:
ra***********@gmail.com wrote:
Dear All
What does exactly below code means
struct File { void* data; };
This declares `struct File' as the type of a struct that contains one element named `data' whose type is "pointer to `void'."
typedef struct File File;
This declares `File' as an alias for `struct File'.
typedef File* fl;
This declares `fl' as an alias for `File*', that is, as an alias for `struct File*'.
Eric Do you mean that "fl" as an alias of the File Pointer, menas that it is alias to the strcut File *(pointer),
Pointer to the file which is of struct type is named as "fl"
Yes. Given these definitions, all the following fragments are equivalent:
struct File s; struct File *p = &s;
File s; File *p = &s;
File s; fl p = &s;
struct File s; fl p = &s;
Thanks to you forver and eric, I got cleared, But have one doubt
in other issue i.e
Below is the code which I find in the Source code
struct FileRecord
{
void *data;
};
typedef struct FileRecord FileRecord;
typedef FileRecord* flReader;
Now I think the above is same as what i understood so I am
writting the code.
typedef struct
{
void *data;
}FileRecord;
typedef FileRecord* flReader;
IF above is correct then it means I understood correctly,
Please bear with me as I dont have the compiler at present.
So I cant check it my understanding.
Thanks
-- Er*********@sun.com ra***********@gmail.com wrote: Below is the code which I find in the Source code struct FileRecord { void *data; }; typedef struct FileRecord FileRecord; typedef FileRecord* flReader;
Now I think the above is same as what i understood so I am writting the code.
typedef struct { void *data; }FileRecord;
typedef FileRecord* flReader;
IF above is correct then it means I understood correctly, Please bear with me as I dont have the compiler at present.
Yes, it is correct. But the struct is untagged i.e. no more "struct
FileRecord" declarations. 'typedef'ing structs is used to ease up
writing effort, but don't over do it, or you will end up not
understanding the code at all. -- Er*********@sun.com
Please remove the above signature in your posts. Its Eric's. ;-)
cheers,
forayer
forayer wrote: ra***********@gmail.com wrote: Below is the code which I find in the Source code struct FileRecord { void *data; }; typedef struct FileRecord FileRecord; typedef FileRecord* flReader;
Now I think the above is same as what i understood so I am writting the code.
typedef struct { void *data; }FileRecord;
typedef FileRecord* flReader;
IF above is correct then it means I understood correctly, Please bear with me as I dont have the compiler at present. Yes, it is correct. But the struct is untagged i.e. no more "struct FileRecord" declarations. 'typedef'ing structs is used to ease up writing effort, but don't over do it, or you will end up not understanding the code at all.
Thanks Forayer, I got the idea behind it and the use of it,
and got clarified by you all. -- Er*********@sun.com
Please remove the above signature in your posts. Its Eric's. ;-)
cheers, forayer
<ra***********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com... Dear All
What does exactly below code means
struct File { void* data; }; typedef struct File File; typedef File* fl;
And thanks to Jaspreet and SM Ryan for the clarifying my previous querry.
Thanks In advance Ranjeet
Very complicated, but in a nutshell - it means:
U.S. companies should stop 'outsourcing'.
:-) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Sarah Tanembaum |
last post by:
Beside its an opensource and supported by community, what's the fundamental
differences between PostgreSQL and those high-price commercial database (and
some are bloated such as Oracle) from...
|
by: Jukka K. Korpela |
last post by:
I have noticed that the meaning of visibility: collapse has been discussed
on different forums, but with no consensus on what it really means.
Besides, implementations differ.
The specification...
|
by: Michael Kalina |
last post by:
Because when I asked for comments on my site-design (Remember? My site,
your opinion!) some of you told me never to change anything on
font-sizes!
What do you guys think of that:...
|
by: lester |
last post by:
a pre-beginner's question:
what is the pros and cons of .net, compared to ++
I am wondering what can I get if I continue to learn C# after I have learned
C --> C++ --> C# ??
I think there...
|
by: Steve Richter |
last post by:
What does the "." mean in the following sql script stmts?
use
GO
if exists (select * from dbo.sysobjects where
id = object_id(N'.')
and OBJECTPROPERTY(id,N'IsUserTable') = 1)
drop table ....
|
by: typingcat |
last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so
on. I've tried many PHP IDEs today, but almost non of them supported
Unicode (UTF-8) file.
I've found that the only Unicode...
|
by: jacob navia |
last post by:
I would like to add at the beginning of the C tutorial I am writing
a short blurb about what "types" are. I came up with the following text.
Please can you comment?
Did I miss something?
Is...
|
by: Frank Rizzo |
last post by:
Some of the classes in the framework are marked as thread-safe in the
documentation. In particular the docs say the following:
"Any public static (*Shared* in Visual Basic) members of this type...
|
by: Jason Huang |
last post by:
Hi,
Would someone explain the following coding more detail for me? What's the
( ) for?
CurrentText = (TextBox)e.Item.Cells.Controls;
Thanks.
Jason
|
by: JoeC |
last post by:
m_iWidth = (int)pBitmapInfo->bmiHeader.biWidth;
m_iHeight = (int)pBitmapInfo->bmiHeader.biHeight;
What does this mean?
I have seen v=&var->member.thing;
but what does it mean when you...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
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,...
|
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...
|
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...
|
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...
|
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,...
|
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...
| |