Coming back from C to C++

  • Thread starter Tomás Ó hÉilidhe
  • Start date
T

Tomás Ó hÉilidhe

I started out with C++ about 8 years ago, but in the last two years or
so I switched to doing a lot of C programming, so I've been out of the
loop for a while.

Anyway I've a few quick questions to ask:

Currently what's the biggest integer type in C++? Does C++ have all
the <stdint.h> types such as uint_fast64_t? I use these types a lot.
Back when I did C++ programming a few years ago, I don't think all C++
implementations were guaranteed to have <stdint.h>. Have things
changed? Also, does C++ have the "long long" integer type that's
guaranteed to be at least 64-Bit?

At the moment I'm working on a multi-threaded networking application
that will have about three threads. One thread will be updating the
screen (which will just be a console program displaying text), one
thread will be sniffing for packets, and another thread will be
sending packets.

I've heard something along the lines of "boost" threads being adopted
into the C++ standard, is this true? What's the most portable multi-
threading library for C++ (I'd like my program to be able to run on as
many kinds of machine as possible).

Another thing: Can anyone suggest what's the most portable networking
library for sending and receiving raw Ethernet frame? In the world of
C, "Berkeley Sockets" seems to be the main one. What about C++, what's
the best networking library to use if you're looking to maximise
portability? (Remember that I need to be able to send and receive full
Ethernet frames).

And one last thing: My program won't have a fancy GUI, it'll just be a
console application. I realise that neither the C nor C++ standard
libraries provide fancy facilities for setting the text colour, but
I'm wondering is there a portable library out there for doing this? I
recall using "conio.h" a few years ago but I don't know if this is the
"de facto" standard.
 
R

red floyd

Another thing: Can anyone suggest what's the most portable networking
library for sending and receiving raw Ethernet frame? In the world of
C, "Berkeley Sockets" seems to be the main one. What about C++, what's
the best networking library to use if you're looking to maximise
portability? (Remember that I need to be able to send and receive full
Ethernet frames).
Berkeley Sockets.

And one last thing: My program won't have a fancy GUI, it'll just be a
console application. I realise that neither the C nor C++ standard
libraries provide fancy facilities for setting the text colour, but
I'm wondering is there a portable library out there for doing this? I
recall using "conio.h" a few years ago but I don't know if this is the
"de facto" standard.
For what platform? "conio.h" is a DOS-ism. In the Unix world,
ncurses (<curses.h>)
is more popular and portable. It all depends. Ask in a group
dedicated to your
platform.
 
G

gpderetta

I've heard something along the lines of "boost" threads being adopted
into the C++ standard, is this true? What's the most portable multi-
threading library for C++ (I'd like my program to be able to run on as
many kinds of machine as possible).

More or less. The current thread support in the draft standard is
inspired on boost.thread but it not the same. About portability, boost
thread works on many Windows variant and on most platforms that
support pthreads. Otherwise you could just program on top of pthreads.
Pthread implementations for windows do exist.
Another thing: Can anyone suggest what's the most portable networking
library for sending and receiving raw Ethernet frame? In the world of
C, "Berkeley Sockets" seems to be the main one. What about C++, what's
the best networking library to use if you're looking to maximise
portability? (Remember that I need to be able to send and receive full
Ethernet frames).

Boost.Asio, which is based on Berkeley Sockets, simplifies synchronous
or asychronous network programming. I'm fairly sure it support raw
sockets. Failing that you can also try ACE or straight Berkeley
Sockets.
 
D

dascandy

Currently what's the biggest integer type in C++? Does C++ have all
the <stdint.h> types such as uint_fast64_t? I use these types a lot.
Back when I did C++ programming a few years ago, I don't think all C++
implementations were guaranteed to have <stdint.h>. Have things
changed? Also, does C++ have the "long long" integer type that's
guaranteed to be at least 64-Bit?

Not yet, and not yet. Both should be added in c++09, which will be (as
you can tell) next year.
Another thing: Can anyone suggest what's the most portable networking
library for sending and receiving raw Ethernet frame? In the world of
C, "Berkeley Sockets" seems to be the main one. What about C++, what's
the best networking library to use if you're looking to maximise
portability? (Remember that I need to be able to send and receive full
Ethernet frames).

Berkeley sockets or pcap-derived things. I think berkeley sockets are
the more portable one.
And one last thing: My program won't have a fancy GUI, it'll just be a
console application. I realise that neither the C nor C++ standard
libraries provide fancy facilities for setting the text colour, but
I'm wondering is there a portable library out there for doing this? I
recall using "conio.h" a few years ago but I don't know if this is the
"de facto" standard.

That depends on the kind of console somebody has. You could use a
library like ncurses to wrap that for you or you can do it yourself.
 

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,968
Messages
2,570,149
Members
46,695
Latest member
StanleyDri

Latest Threads

Top