TIP: Click on subject to list as thread! ANSI
echo: nthelp
to: Geo
from: Gregg N
date: 2004-10-18 21:55:46
subject: Re: Organizing source code

From: Gregg N 

Geo wrote:
> "Gregg N"  wrote in message
> news:4173e605$1{at}w3.nls.net...
>
>
>>Which .h files?
>
> umm.. all the ones I didn't write (like math.h)?

I thought you were asking about organizing the code you write. If it is not
your code, and especially something like math.h which is part of your
compiler's library, you probably don't have much flexibility in where they
go.

>>C++ does strings.
>
> Well I'm certainly no expert considering I've only started taking this class
> but as I understand it a C++ string is actually a character array, like
> "char bob[]" instead of an actual string like
"bob$". I know they are
> similar as I already wrote a bubblesort routine but the teacher made a point
> to me that it's not a text string like in other languages, that there is
> some significant difference although she didn't explain it any further than
> that yet.

That would be a C-style string, which C++ also supports. For most new C++
development, it is recommended you use string objects instead of character
arrays. That means using things like std::string, std::stringstream, string
assignment instead of strcpy, etc. It sounds like your instructor is
teaching you C, not C++. See

http://www.research.att.com/~bs/new_learning.pdf

for advice on teaching C++ as a new language. You might want to give your
instructor a copy.

> OK now go easy on me. Basically we've used 3 libs in class, ,
>  and  so I'm sitting here wondering
where these come from
> and how I find out what other ones are available in the standard visual
> studio install and how I find out what functions they provide. If I'm
> understanding you and Antti, that information is contained in MSDN so I need
> to install that on my laptop along with the visual c++ I've already
> installed? Ok that's easy.

You need to run away from this instructor and find a good one. The headers
 and  are obsolete headers that are not
part of standard C++. They were part of a de facto standard circa 1998, but
were made obsolete in 1998 when the formal standard was published. Most of
the current standard headers do not have a .h suffix (e.g., it is just
). The older headers are usually included even in newer
compilers for backward compatibility, but their contents is not the same,
especially for iostream and related classes.

To find functions and classes in Visual C++, I first try incremental search
in the index. If that is not successful, I use full text search. If that is
not successful, I use groups.google.com to see if I can get a hint where to
look next.

I recommend you get a copy of Josuttis' book "The C++ Standard
Library: A Tutorial and Reference". This is a very well written book
that describes just about everything in the standard library.

http://www.amazon.com/exec/obidos/tg/detail/-/0201379260/103-0947552-4706221?v=
glance

For an introduction to C++ itself for someone who knows other programming
languages, I recommend Koenig's Accelerated C++:

http://www.amazon.com/exec/obidos/ASIN/020170353X/qid=1098149926/sr=2-1/ref=pd_
ka_b_2_1/103-0947552-4706221

> But to use my example, suppose I'm looking for a function to find a string
> within a string (knowing they aren't strings) how the heck do you go about
> finding the function if it exists? Isn't there a list of some sort somewhere
> for the basic set that appears to be included?

I guess experience tells me that this is the sort of thing that would make
sense as a class member function, so the first place I would look is at the
member function list for the string class. If you look up std::string, you
will find that it is actually a typedef for a std::basic_string
(this allows C++ to support both 8-bit and 16-bit characters). Looking up
std::basic_string, you will see it has a member named "find".

Gregg

--- BBBS/NT v4.01 Flag-5
* Origin: Barktopia BBS Site http://HarborWebs.com:8081 (1:379/45)
SEEN-BY: 633/267 270 5030/786
@PATH: 379/45 1 396/45 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.