Hi,
Simple questions, How to find where types are defined?
And, how can I find which paths are considered standard by my g++?
I get,
error: 'off_t' does not name a type
I know that if I add the following bunch
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
it will go away. but how can I find which exactly .h file defines the
type off_t?
Ref:
$ apropos off_t
$ man -k off_t
PS. I know the .h is not the "correct" include syntax for cpp files, but
this is a legacy cpp program that I want to alter as little as possible.
thanks
-- 5 7134
In article <05******************************@golden.net>, * Tong *
<su**********@users.sourceforge.netwrote:
Simple questions, How to find where types are defined?
And, how can I find which paths are considered standard by my g++?
I get,
error: 'off_t' does not name a type
I know that if I add the following bunch
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
it will go away. but how can I find which exactly .h file defines the
type off_t?
Divide-and-conquer. Remove half the #include lines, then recompile. If the
error occurs, it's defined in the half you removed, otherwise it's defined
in the half you kept. Repeat this procedure with the half it's in, until
you get down to a single header file. Look up "binary search" for more.
For information about your compiler, refer to documentation or the
appropriate newsgroup (there's probably one for g++, part of the GNU
Compiler Collection).
On 2008-10-20 19:38, * Tong * wrote:
Hi,
Simple questions, How to find where types are defined?
And, how can I find which paths are considered standard by my g++?
By reading the gcc manual.
I get,
error: 'off_t' does not name a type
I know that if I add the following bunch
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
it will go away. but how can I find which exactly .h file defines the
type off_t?
C++ does not define any off_t, but there is a OFF_T which can be found
in <ios>. POSIX on the other hand does define a off_t in <sys/types.h>.
--
Erik Wikström
On 2008-10-20 13:59:24 -0400, Erik Wikström <Er***********@telia.comsaid:
>
C++ does not define any off_t, but there is a OFF_T which can be found
in <ios>. POSIX on the other hand does define a off_t in <sys/types.h>.
Actually, there isn't an OFF_T in C++. That name is used in the
standard as a placeholder for an implementation-specific type that
meets certain requirements, so it can be used to define the nested type
std::traits<char>::off_type, etc.
--
Pete
Roundhouse Consulting, Ltd. ( www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
( www.petebecker.com/tr1book)
On 2008-10-22 15:59, Stefan Ram wrote:
* Tong * <su**********@users.sourceforge.netwrites:
>>it will go away. but how can I find which exactly .h file defines the type off_t?
The question still is open:
In C++, we have certain »parts« of the language (including the
standard library) that require certain include directives.
These parts include:
- names
- operators
- preprocessor names
. (Did I miss some part type?)
Now, given any part, say, »fmtflags«¹, one would like to know
which include directive is required.
This can not be tried by using a C++ implementation, because
some include directives might declare the part by coincidence,
but not because ISO/IEC 14882:2003(E) requires them to do so.
One would like to have a means to look-up each part, a list
of all those parts (possibly with their fully qualified name),
where each entry gives a specific include directive that is
guaranteed by ISO/IEC 14882:2003(E) to declare this part.
boolalpha ::std::boolalpha #include <ios>
fmtflags ::std::ios::fmtflags¹ #include <ios>
ostream ::std::ostream #include <ostream>
setprecision #include <iomanip>
<< #include <iostream>
... ... ...
So, the question is, where to find such a list, or whether
there is a simple procedure to get the last column from the
first one.
To my knowledge there is no such list today, but if you have a copy of
the standard you can search it for the identifier or whatever and find
out what header declares it.
--
Erik Wikström
On Oct 20, 1:38 pm, * Tong * <sun_tong_...@users.sourceforge.net>
wrote:
Hi,
Simple questions, How to find where types are defined?
Get the compiler to print the preprocessed input, and
search for your type:
g++ -E foo.cpp | egrep '^#|\<off_t\>'| grep -B10 off_t
And, how can I find which paths are considered standard by my g++?
g++ -v foo.cpp
Sean This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Andy Skypeck |
last post by:
I am looking for some validation against a dubious coding practice
that prevails where I work. C types defined in types.h (Linux) or
stdint.h (Windows, C99?) are used as if they belong to the C++...
|
by: nekiv90 |
last post by:
Greetings,
I was able to create the structured type:
CREATE TYPE address_t AS
( street char(30),
city char(15),
state char(10),
postcode smallint )
MODE...
|
by: infobahn |
last post by:
printf("%p\n", (void *)0); /* UB, or not? Please explain your answer. */
|
by: santosh |
last post by:
Hello all,
Conversion macros along the name of INT8_C, INT16_C etc, are defined in
stdint.h to convert their argument into suitable representations for
their corresponding types, i.e. int8_t,...
|
by: leo.hou |
last post by:
Hi experts,
I am new to linux and all the type definitions are driving me mad. What
is the best way to check a type definition in linux? When I use man
page to check some function definition, I...
|
by: jacob navia |
last post by:
As Richard Bos rightly pointed out, I had left in my classification
of types the C99 types Complex and boolean. Here is a new
classification. Those are not mentioned in the classification
of...
|
by: Frodo Baggins |
last post by:
Hi all,
We are using strcpy to copy strings in our app. This gave us problems
when the destination buffer is not large enough. As a workaround, we
wanted to replace calls to strcpy with strncpy....
|
by: szczepiq |
last post by:
Pardon me for most likely a dummy question but how do I find out if an
object is a class?
I need something like that:
def foo(self, obj):
if (obj is a class):
some stuff
|
by: tonytech08 |
last post by:
How valuable is it that class objects behave like built-in types? I
appears that the whole "constructor doesn't return a value because
they are called by the compiler" thing is to enable...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
| |