Does c++ have an uniform class library?

J

JTL

I have learnt java before and now begin to learn c++

what puzzle me is that seem that different SDKs(c++builder, vs.net,
gcc..) has its own class library
we know that in java there are only one uniform class library
so that the codes I written in JBuilder can just copy to JCreator or
Eclipse
and they all run well

does c++ have such an uniform class library so that I could just learn
only one time
and then I can use it in c++builder or vs.net or gcc, just the same
codes
what's this uniform class library's name?

if they(c++builder, vs.net,gcc) use different librarys, what class
library do they use?
which library is most usefully or most common ?

Thank you very much in advance.
 
D

Davlet Panech

JTL said:
I have learnt java before and now begin to learn c++

what puzzle me is that seem that different SDKs(c++builder, vs.net,
gcc..) has its own class library
we know that in java there are only one uniform class library
so that the codes I written in JBuilder can just copy to JCreator or
Eclipse
and they all run well

does c++ have such an uniform class library so that I could just learn
only one time
and then I can use it in c++builder or vs.net or gcc, just the same
codes
what's this uniform class library's name?

Yes, the language standard (ISO/IEC 14882) describes a number library
facilities that every C++ compiler is supposed to provide. These
libraries are sometimes called "the Standard C++ library", or "standard
template library, STL" (they are not 100% identical, STL is older).
if they(c++builder, vs.net,gcc) use different librarys, what class
library do they use?
which library is most usefully or most common ?

The standard library is the common subset of them all.

D.
 
A

Alf P. Steinbach

* JTL:
I have learnt java before and now begin to learn c++

what puzzle me is that seem that different SDKs(c++builder, vs.net,
gcc..) has its own class library

In addition to the C++ standand library, yes.

we know that in java there are only one uniform class library
so that the codes I written in JBuilder can just copy to JCreator or
Eclipse

No, we don't know that. Java has a more extensive "standard" library
than C++, except that (nit-picking my own statement) Sun chickened out
from the standardization process so that Java isn't standardized.
Still, Java isn't so poor a language that there aren't any third-party
libraries.

and they all run well

That might seem to be the case for simple applications, yes.

does c++ have such an uniform class library so that I could just learn
only one time
and then I can use it in c++builder or vs.net or gcc, just the same
codes
what's this uniform class library's name?

That's the C++ standard library. But the standard library intentionally
covers only functionality that is very general and platform-independent.
The C++ model is that instead of one huge standard library you can
choose the third-party library you want, or make your own (and that's
why Java's platform-independence is founded on a virtual machine and
platform-specific adaptions of its libraries, written in C and C++).

if they(c++builder, vs.net,gcc) use different librarys, what class
library do they use?
which library is most usefully or most common ?

Undoubtedly the C++ standard library.
 
?

=?ISO-8859-1?Q?Erik_Wikstr=F6m?=

I have learnt java before and now begin to learn c++

what puzzle me is that seem that different SDKs(c++builder, vs.net,
gcc..) has its own class library we know that in java there are only
one uniform class library so that the codes I written in JBuilder can
just copy to JCreator or Eclipse and they all run well

does c++ have such an uniform class library so that I could just
learn only one time and then I can use it in c++builder or vs.net or
gcc, just the same codes what's this uniform class library's name?

if they(c++builder, vs.net,gcc) use different librarys, what class
library do they use? which library is most usefully or most common ?

There is something called STL (Standard Template Library) which is a
very powerful library, though it's nowhere near as comprehensive as
those of Java or .Net or most others. However depending on what you
want to do with your application they can be more than enough. STL is
part of the C++ standard so you can expect it to work with any decent
C++ compiler.

STL does not include any GUI-features so if you're out to make
applications with a GUI you'll have to find some third-party library to
use, there are a couple of third-party libraries/frameworks providing
GUI-classes and more that try to be platform-independent, meaning that
the code should just work when going from Linux to Windows or such. Qt
and GTK are examples of such libraries/frameworks.
 
J

JTL

Thank you very much for your help

I get more clearly now
different SDK have its own library
but all of they can use the Standard C++ library
so now I plan to begin with the STL
and use MFC to make UI
 
I

IR

JTL said:
and use MFC to make UI

You'd really better use wxWidgets or Qt. Or if you *have* to use
something Microsoft specific, their WTL. If you have access to Borland
C++ Builder, their VCL is not that bad for RAD (and it is very easy to
learn and use).

But the MFC is one of the worst pieces of code I ever saw, and is
really outdated by now. Unless you have legacy MFC code to maintain
(which, according to your post, I doubt), don't even bother learning
it.

Just my thoughts though.
 
J

JTL

do you means wxWidgets or Qt is better than MFC in making windows UI?
but I haven't heard them before......
I think as I want to make UI in MS windows,it's better to choose MS's
MFC....
 
?

=?ISO-8859-1?Q?Erik_Wikstr=F6m?=

do you means wxWidgets or Qt is better than MFC in making windows UI?
but I haven't heard them before......
I think as I want to make UI in MS windows,it's better to choose MS's
MFC....

Just because you've heard a lot about MFC does not make it good, rather
you might have heard about it because many consider it not good :)
And besides, MFC is on it's way out, if you want to learn something, go
for something that will last a few years, if you still want to go the MS
way take a look at .Net. If not you might want to take a look at Qt,
which is quite well known (along with others).
 
J

JTL

it sounds interesting that Qt and wxWidgets can be used in windows and
linux
I know nothing about the C++ world...

if I don't need UI,the STL is the best choice to learn,is it right£¿

do Qt or wxWidgets need a runtime environment?
(just as java need the JRE and .net need the .net framework)

as in WindowsXP,how do they build a window?
in java,it call JRE,and JRE call the windows API,is it right£¿
in .net,it call .net framework,and .net framework call the windows
API,is it right£¿
but in MFC or Qt or wxWidgets,it just call the windows API directly to
make a window,is it right£¿

so the .net must need the customer to install the .net framework(like
java)
but Qt or wxWidgets don't need so, just run it,is it right£¿
 
E

eriwik

it sounds interesting that Qt and wxWidgets can be used in windows and
linux
I know nothing about the C++ world...

if I don't need UI,the STL is the best choice to learn,is it right?

Yes, since it can be used always (even if you use a GUI) you should
take some time to learn it.
do Qt or wxWidgets need a runtime environment?
(just as java need the JRE and .net need the .net framework)

Don't know about wxWidgets but Qt does not need on. I suspect that
wxWidgets don't need one either, since it's not the Java GUI or .Net
GUI that does require the runtime but rather the languages. I'm not
sure, but it might be possible to do unmanaged .Net GUI, in which case
you would not need a runtime either (but you'll still need the .Net
libraries installed).
as in WindowsXP,how do they build a window?
in java,it call JRE,and JRE call the windows API,is it right?
in .net,it call .net framework,and .net framework call the windows
API,is it right?
but in MFC or Qt or wxWidgets,it just call the windows API directly to
make a window,is it right?

Probably, but you don't have to worry about that.
so the .net must need the customer to install the .net framework(like
java) but Qt or wxWidgets don't need so, just run it,is it right?

Qt will require you to distributa a DLL-file (on windows) along with
your application, unless you compile it statically.
 
J

JTL

so all of them must call the windows API finally to make a window
what's this windows API's name?(does it have?)
is it a library or some DLLs?
and what's the "win32 program"
are they the same?
 
E

Evan

JTL said:
so all of them must call the windows API finally to make a window
what's this windows API's name?(does it have?)

The Windows API. ;-)

(No, I'm serious! That's its name. No one ever said that MS products
don't have descriptive names.) It's somewhat infomally called the Win32
API
is it a library or some DLLs?

DLLs are libraries. Specifically, they're ones that could be loaded
during the execution of your program rather than linked in at compile
time. (DLL stands for dynamic link library. Again with the descriptive
names.)
and what's the "win32 program"

A program built that uses the Windows API.


Note though that the Windows API is a pure C API, so you don't get the
benefits of C++ language features. It's very instructive to write at
least a simple program using it at some point, but I'm not sure that I
would want to use it for an actual project because it's not C++.

I don't quite get what all the hating is with MFC actually, especially
among those who advocate wxWidgets. There's some MFC macro uglyness,
but that's also present in wxWidgets. (At least was a couple years
ago...) However, the other posters are correct in saying that its on
its way out. MS is pushing .Net now, and Windows Forms.

Evan
 
A

Alf P. Steinbach

* Evan:
Note though that the Windows API is a pure C API, so you don't get the
benefits of C++ language features. It's very instructive to write at
least a simple program using it at some point, but I'm not sure that I
would want to use it for an actual project because it's not C++.

Parts of the Windows API are adapted to script languages, and large
tracts of it (the COM-based parts) are adapted to early C++.

I don't quite get what all the hating is with MFC actually, especially
among those who advocate wxWidgets.

Mostly that MFC employs two-phase construction. From that, other
equally Bad things follow, which can be summarized as dynamic type
checking and no type checking replacing static type checking. That's
not to say that any particular other library is better, just that MFC
was intentionally designed for C programmers moving to C++: the most
C++'ish features were IIRC removed from the original more C++-like
framework called AFX (that name still lingers in MFC's code).

It's an example of the market place not being ready for radical change
but accepting with whooping joy a small incremental change (it's just
like we always done -- easily recognized -- only better!), which
then becomes a de facto standard for some years, until its bizarre
limitations become too painful to stand.
 
B

bogdan

"""JTL ÐÉÓÁÌ(Á):
"""
I have learnt java before and now begin to learn c++

what puzzle me is that seem that different SDKs(c++builder, vs.net,
gcc..) has its own class library
we know that in java there are only one uniform class library
so that the codes I written in JBuilder can just copy to JCreator or
Eclipse
and they all run well

does c++ have such an uniform class library so that I could just learn
only one time
and then I can use it in c++builder or vs.net or gcc, just the same
codes
what's this uniform class library's name?

if they(c++builder, vs.net,gcc) use different librarys, what class
library do they use?
which library is most usefully or most common ?

Thank you very much in advance.



http://magegame.ru/?rf=626f6764616e
 
K

kwikius

Alf P. Steinbach wrote:

Mostly that MFC employs two-phase construction. From that, other
equally Bad things follow, which can be summarized as dynamic type
checking and no type checking replacing static type checking.
From what I can see some form of two phase construction seems to be
necessary, and it seems to be the way things are done in most GUI libs.
At the level of the application window at least:

int main()
{
my_window w;

w.start(); // or run or open or modal loop etc

// if here user pushed button "Exit" or whatever

}

Once the window is 'switched on' the application turns form a
procedural application to an event driven one. Without differentating a
dead and live window (IOW if using single phase construction) you can't
pass windows around before the window event loop starts:

void f(window w)
{
/* ... do something with window*/
}
int main()
{
window w; // single phase construction style window
f(w) ;// f actually entered only after the window has been closed
}

regards
Andy Little
 
I

IR

kwikius said:
Alf P. Steinbach wrote:



necessary, and it seems to be the way things are done in most GUI
libs. At the level of the application window at least:

int main()
{
my_window w;

w.start(); // or run or open or modal loop etc

// if here user pushed button "Exit" or whatever

}

Once the window is 'switched on' the application turns form a
procedural application to an event driven one. Without
differentating a dead and live window (IOW if using single phase
construction) you can't pass windows around before the window
event loop starts:

void f(window w)
{
/* ... do something with window*/
}
int main()
{
window w; // single phase construction style window
f(w) ;// f actually entered only after the window has been
closed
}

A window and it's contents exist and can be accessed/modified
independently of whether you are running the event loop or not (does
Send(Notify)Message ring a bell?).

So there is really no need for that evil two-phase construction.


Cheers,
 
K

kwikius

IR said:
A window and it's contents exist and can be accessed/modified
independently of whether you are running the event loop or not (does
Send(Notify)Message ring a bell?).

So there is really no need for that evil two-phase construction.

int main()
{
one_phase_window w;
}

Where exactly are you going to put your send_message in, before the
window runs, or after it quits?

regards
Andy Little
 
A

Alf P. Steinbach

* kwikius:
Alf P. Steinbach wrote:



necessary, and it seems to be the way things are done in most GUI libs.
At the level of the application window at least:

int main()
{
my_window w;

w.start(); // or run or open or modal loop etc

// if here user pushed button "Exit" or whatever

}

Once the window is 'switched on' the application turns form a
procedural application to an event driven one. Without differentating a
dead and live window (IOW if using single phase construction) you can't
pass windows around before the window event loop starts:

void f(window w)
{
/* ... do something with window*/
}
int main()
{
window w; // single phase construction style window
f(w) ;// f actually entered only after the window has been closed
}

Since you're (as I recall) developing a GUI framework for C++ with the
aim of inclusion in Boost or perhaps even the standard (that would be
C++1x?), it is perhaps on-topic to discuss this.

No, two-phase construction is not necessary, not even for modal dialogs.
The main thing to note about about modal dialogs is that from the
client code's view they're not really windows. They're functions.

I once implemented a little app -- it's a Windows system tray app for
controlling the screen saver -- just demonstrating the principle, that
once you have an object in hand, it's fully constructed and working,
strict C++ RAII principle. There are a few bugs but people were very
happy with it; I use it myself... You can find the source code at <url:
http://home.no.net/alfps/root/programs/ScreenSaverManager/download.html>.

Since then, early 2002, others have reportedly done the same but as
full-fledged GUI frameworks.

One that at least from the discussion about it sounded very OK, using
templates and the standard library and strictly C++ RAII-oriented, was
discussed in a series of articles in some C++ magazine (not DDJ);
perhaps you'll find it by searching the net.
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top