fpos_t

  • Thread starter Bill Cunningham
  • Start date
B

Bill Cunningham

Why on my system is fpos_t 128 bit? And long and long long are 64 bit
while int is 32 bit. Is fpos_t an alias for some struct type of some kind?
man fpos_t shows nothing so I don't know if it has a man page. Is fpos_t a
typedef or something?

Bill
 
B

Ben Bacarisse

Bill Cunningham said:
Why on my system is fpos_t 128 bit?

I am tempted to ask why you are surprised by this but I am not sure that
would help anyone. On my system, it is made up of a file position and a
piece of data used to record the state of any multibyte character
encoding that might be in force.
And long and long long are 64
bit while int is 32 bit. Is fpos_t an alias for some struct type of
some kind?

Almost certainly. The C standard says that is must be a complete
non-array object type, and that means is it very often a struct type.
man fpos_t shows nothing so I don't know if it has a man
page. Is fpos_t a typedef or something?

Yes, it's a typedef.
 
B

Bill Cunningham

Ben Bacarisse said:
I am tempted to ask why you are surprised by this but I am not sure that
would help anyone. On my system, it is made up of a file position and a
piece of data used to record the state of any multibyte character
encoding that might be in force.


Almost certainly. The C standard says that is must be a complete
non-array object type, and that means is it very often a struct type.


Yes, it's a typedef.

I can't find a structs elements anywhere. I am assuming this would begin
then with:

typedef struct... so on.
 
B

Barry Schwarz

Why do you care? Surely you are not planning to try to manipulate its
internal components directly?

Does man size_t show anything on your system? What about man FILE?
What would you expect a man page to say about a type that is
deliberately opaque?
I can't find a structs elements anywhere. I am assuming this would begin
then with:

typedef struct... so on.

Where are you looking? What is the text you are searching for?

fpos_t is a type that is declared in stdio.h. What do you find when
you search stdio.h for fpos_t?
 
J

James Kuyper

On 05/01/2014 05:33 AM, Barry Schwarz wrote:
.....
fpos_t is a type that is declared in stdio.h. What do you find when
you search stdio.h for fpos_t?

It would be more precise to say that it is declared as a result of
#including <stdio.h>. It's possible, and in my experience, commonplace,
for a standard header to #include other files, which do some or all of
the actual work. As a result, Bill might not be able to find it by
merely looking at the one file. He might have to track down the
#includes, which might be too complicated a task for him.

It would also be perfectly conforming for standard headers to be
implemented without the use of standard header files at all, which is
why the standard goes out of it's way to avoid using the term "file"
when talking about them.
 
B

Bill Cunningham

James Kuyper said:
It would be more precise to say that it is declared as a result of
#including <stdio.h>. It's possible, and in my experience, commonplace,
for a standard header to #include other files, which do some or all of
the actual work. As a result, Bill might not be able to find it by
merely looking at the one file. He might have to track down the
#includes, which might be too complicated a task for him.

It would also be perfectly conforming for standard headers to be
implemented without the use of standard header files at all, which is
why the standard goes out of it's way to avoid using the term "file"
when talking about them.

It's not in stddef.h either that I can see. I don't know about stdarg.h
 
B

Bill Cunningham

Barry Schwarz said:
Why do you care? Surely you are not planning to try to manipulate its
internal components directly?

I wanted to see them.
Does man size_t show anything on your system? What about man FILE?

It's 216 bytes! I think I might see it.
 
K

Keith Thompson

James Kuyper said:
On 05/01/2014 05:33 AM, Barry Schwarz wrote:
....

It would be more precise to say that it is declared as a result of
#including <stdio.h>. It's possible, and in my experience, commonplace,
for a standard header to #include other files, which do some or all of
the actual work. As a result, Bill might not be able to find it by
merely looking at the one file. He might have to track down the
#includes, which might be too complicated a task for him.

It would also be perfectly conforming for standard headers to be
implemented without the use of standard header files at all, which is
why the standard goes out of it's way to avoid using the term "file"
when talking about them.

If you're curious about how your system defines fpos_t and you
happen to be using gcc, you can do this:

echo '#include <stdio.h>' | gcc -E - | less

and search for "fpos_t". "-E" tells gcc to write the output of
the preprocessor to standard output; "-" tells it to read from
standard input rather than from a source file. "less" is a text
viewing program; if you prefer, you can send the output of gcc to
a temporary file and view the file using your favorite text editor.
Other compilers likely have options to do something similar.

You'll probably have to search for other declarations that are used
in the definition of fpos_t.

Be aware that, in a typical implementation, neither the contents
of the standard headers nor the output of the preprocessor are
designed to be easily human-readable.

This will tell you how your system defines fpos_t. It will *not*
give you any information that any program that uses fpos_t can or
should make use of. All the information you need to *use* fpos_t
can be found in the C standard, namely that it's

a complete object type other than an array type capable of
recording all the information needed to specify uniquely every
position within a file

and that fsetpos() and fgetpos() take an argument of type pointer to
fpos_t. On systems I have access to at the moment, I see fpost_t
defined as an integer type on some and as a struct on others.
 
K

Ken Brody

Alternatively since you're hitting the command line

echo '#include <stdio.h>' | gcc -E - | grep -B 10 -A 10 -i fpos_t

and tweak as you see fit,

On the IDE I use, I can simply right-click on "fpos_t" and select "show
definition", and the IDE will open the proper header file and highlight the
definition.
 
P

Phil Carmody

[SNIP - usual trollery]

Stop fucking morphing. (It looks like 5 lines in my scorefile
with that general name now, if that isn't proof he's a troll
I don't know what is.)

And will you twonks stop bloody feeding him?

Phil
 
K

Kaz Kylheku

[SNIP - usual trollery]

Stop fucking morphing.

How is he morphing? The "Bill Cunningham" spelling has not changed in
a decade and a half.

Stop fucking matching on the <...> part of the From: line!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,835
Latest member
KetoRushACVBuy

Latest Threads

Top