Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > C++: String data type

Reply
Thread Tools

C++: String data type

 
 
Sam Holden
Guest
Posts: n/a
 
      08-26-2003
On Tue, 26 Aug 2003 16:24:03 +0930,
Newsnet Customer <(E-Mail Removed)> wrote:
>
>> > > > 2) I assume system header files provides implementations unlike
>> > user-defined
>> > > > header files, which are just interfaces.
>> > >
>> > > That's not a question. As an assumption, it's incorrect. For a start,

> in
>> > > the statement '#include <string>', the word 'string' is not a

> filename.
>> > > The necessary declarations, etc., may or may not be stored in a file.
>> >
>> >
>> > if string is not a filename then what file is it actually including in

>> this
>> > case? an object string?

>>
>> The name of the *header* is <string>. The statement:
>>
>> #include <string>
>>
>> Is simply required to cause the compiler to provide
>> all declarations the language specifies it must, at
>> the scope where the #include directive appears.
>>
>> A compiler is free to provide these delcarations any
>> way at all, e.g. via a file, 'hard coded' into the
>> compiler, or any other way at all. It's very common
>> for standard headers to be represented with files,
>> but not at all required.

>
> I asummed that if the header does not have an extension associated with it
> then it's not a file, which leaves me thinking what <string> represents. I
> don't think you have exactly told me that, but it appears that it could be
> 'hard-coded' into the compiler.


Your assumption is incorrect. The header could be implemented as a file,
or it could just set a flag in the compiler, or whatever.

As a counter example to your assumption:

$ ls -l /gnu/usr/include/g++-3/string
-rw-rw-r-- 1 bin bin 238 Nov 18 1999 /gnu/usr/include/g++-3/string

That compiler/library combination implementation uses a file named 'string' to
perform #include <string>.

--
Sam Holden

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
#define ALLOCIT(Type) ((Type*) malloc (sizeof (Type))) Yevgen Muntyan C Programming 10 02-13-2007 02:52 AM
Convert string data type to char type ? tvn007@hotmail.com C++ 6 10-20-2005 02:22 PM
Re: Type casting- a larger type to a smaller type pete C Programming 4 04-02-2004 05:19 PM
Re: Type casting- a larger type to a smaller type heyo C Programming 3 04-01-2004 06:35 PM
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. luna ASP .Net 1 02-13-2004 01:15 PM



Advertisments