C++ in Linux or Windows

J

Johs

Are there any difference between writting C++ in linux or Windows?

I was told that it was only a matter of available IDE's (eclipse for both
platforms, but only Visual Studio for Windows) but are there other
techincal/syntatical/standard library function differences?

Johs
 
O

Obnoxious User

Johs skrev:
Are there any difference between writting C++ in linux or Windows?

I was told that it was only a matter of available IDE's (eclipse for both
platforms, but only Visual Studio for Windows) but are there other
techincal/syntatical/standard library function differences?

You'll encounter the difference when you need platform specific api. As
long as you dwell inside the c++ standard sandbox, you're safe, although
there are libraries that extend the boundaries of that sandbox to ease
cross-platform development.
 
L

Lionel B

Are there any difference between writting C++ in linux or Windows?

I was told that it was only a matter of available IDE's (eclipse for
both platforms, but only Visual Studio for Windows) but are there other
techincal/syntatical/standard library function differences?

Well, in theory there should be no difference in terms of syntax and
standard library functionality. Some things to bear in mind, though:

1) The language specification generally does not mandate *implementation*
of language/library features beyond required functionality, so that
different compilers - possibly on the same platform - may well implement
features differently (this may, for example, manifest itself in time/
memory usage of some function). Also, there are very many instances of
potential "undefined behaviour" in the language spec; if you hit one of
these all bets are off and you can't expect similar results across
platforms/compilers.

2) Compilers may provide non-standard extensions to the language and
standard library (hopefully they will also provide a means of "turning
off" non-standard features and enforcing strict language/standard library
compliance).

3) There are likely to be wildly disparate assortments of OS-specific
libraries available for various platforms, particularly in areas where
the C++ standard does not provide functionality (eg. GUIs, threading,
inter-process communication, networking, etc.). Some of these libraries
may (attempt to) be cross-platform, others not.

If you stick to strict language standards compliance and avoid non-
portable libraries then, you should encounter no significant differences
in the language across platforms; of course this may not be possible,
depending on what you are trying to program.

IDEs are a matter of (in)convenience - you may not need/want to use one
(I don't).
 
Z

Zeppe

Heh - thought I was the only one. Gvim and make for me...

it's just for the 99.99% of the common human beings (I'm among them)
that a good IDE like Visual Studio improves the productivity by 300%...

Regards,

Zeppe
 
V

Victor Bazarov

Zeppe said:
it's just for the 99.99% of the common human beings (I'm among them)
that a good IDE like Visual Studio improves the productivity by
300%...

.... yeah, and now you will also tell us that a debugger is useful,
right? Pff! All my code runs the first time around -- I don't need
no stinking debuggers! <g>
 
H

Howard

Victor Bazarov said:
... yeah, and now you will also tell us that a debugger is useful,
right? Pff! All my code runs the first time around -- I don't need
no stinking debuggers! <g>

Personally, I prefer Zen Programming. No need for compilers, or even code
editors. The program simply is.

-Howard
 
V

Victor Bazarov

Howard said:
Personally, I prefer Zen Programming. No need for compilers, or even
code editors. The program simply is.

IIUIC, when you practice Zen Programming, there *is* no program. Only
your awareness of it exists. :)
 
J

James Kanze

Heh - thought I was the only one. Gvim and make for me...

I don't think any professional programmer uses one in his
professional work. At least, I've never met one who did (and as
a consultant, I see a lot of different workplaces). Judging
from what little I've seen of them, they generally don't offer
the functionality you need for a professional environment.

That doesn't mean that they're without use. I would hardly like
to tell a beginning programmer that before compiling his first
program, he has to learn make. And depending on the
environment, they may be useful for various types of
experimenting (although most of the people I know have set up
their environment so that they can experiment quite easily
without one).
 
J

James Kanze

it's just for the 99.99% of the common human beings (I'm among them)
that a good IDE like Visual Studio improves the productivity by 300%...

Does it really? Then why isn't it used by the most productive
programmers?

An IDE has the advantage of being easy to learn. Typically, the
easier something is to learn, the less powerful it is, and the
less productive you are once you have invested the effort to
learn it. Without any previous knowledge, I'm sure that you can
write and compile a program quicker with Visual Studios than
with gvim/shell/makefiles, etc. Once you have learned the
classical toolset, however, I suspect the reverse is true; at
least, I've never seen anyone really effective with Visual
Studios (or with any other IDE).
 
Z

Zeppe

James said:
Does it really? Then why isn't it used by the most productive
programmers?

and this information where does it comes from?
An IDE has the advantage of being easy to learn.

and easy to keep in mind. That is, if I don't remember something that I
don't use every day, I can expect to find it quite quickly.
Typically, the
easier something is to learn, the less powerful it is, and the
less productive you are once you have invested the effort to
learn it. Without any previous knowledge, I'm sure that you can
write and compile a program quicker with Visual Studios than
with gvim/shell/makefiles, etc.

there is no doubt.
Once you have learned the
classical toolset, however, I suspect the reverse is true;

oh, well. It depends, actually. Probably if you are able to keep in mind
every shortcut in vim, every syntax rule of your makefiles and
everything yuo wrote in them, etc, probably it is true. But if you have
to remove a specific warning or defining a preprocessor symbol in a
specific compilation unit, just for example, and you have a makefile
that you have written long time ago, or you don't have written at all,
because in the real world you don't work just with your code, I think
that a left click of the mouse and a check into a box would be faster
than looking for the appropriate makefile, find the compilation unit,
hope that is written in such a way you can specify a rule for each
compilation unit, and then add the command that you have to keep in mind
anyway in order not to have to look at the manpage of gcc.

It's the same principle why it's easier exploring a program during the
debug through the IDE, moving through the program stack by clicking on
the single functions, keeping under control multiple variables in a
subwindow, than keeping in mind thousand of "bt", "sb" (I think) and
other obfuscated gdb commands.

Regards,

Zeppe
 
D

dave_mikesell

it's just for the 99.99% of the common human beings (I'm among them)
that a good IDE like Visual Studio improves the productivity by 300%...

Maybe if you're doing .net or Windows or some other huge API and need
Autosense. Slows me down. Also, if working with Java I like
Eclipse for its ability to hyperlink/jump to definitions of classes/
methods easily if the code base is large (been a while...think it was
Eclipse), although it's a horrible memory pig.

For C++, though, I'm much faster opening all of the buffers I'm
working on in Gvim. To each his own, I guess.
 
Z

Zeppe

For C++, though, I'm much faster opening all of the buffers I'm
working on in Gvim.

is not just a matter of pure writing. It's everything: managing the
configuration, building, debugging and so on. Anyway, the last versions
of gvim provide the integration in visual studio, maybe you like it :)
To each his own, I guess.

Sure :)

Regards,

Zeppe
 
D

dave_mikesell

is not just a matter of pure writing. It's everything: managing the
configuration, building, debugging and so on.

You only set up the configuration (libraries to link with, include
dirs, settings, etc.) once, though. After that it's coding and
building. Too much moving between keyboard and mouse for me with an
IDE, and I like making my GVim window fullscreen. Don't need a class
browser taking 30% of the screen on the left, and an output window
taking another 30% at the bottom.

Switching between configurations is as easy as "make clean debug" vs
"make clean all". It's easy to add targets to generate Doxygen info,
packaging an install executable, etc.
 
A

Adrian

Are there any difference between writting C++ in linux or Windows?

I was told that it was only a matter of available IDE's (eclipse for both
platforms, but only Visual Studio for Windows) but are there other
techincal/syntatical/standard library function differences?

Even if you stick to standard C++ paths passto any file access
functions are system dependent. The one thing I would watch out for is
the \ and / in file paths and drive letters.


Adrian
 
A

Adrian

Are there any difference between writting C++ in linux or Windows?

I was told that it was only a matter of available IDE's (eclipse for both
platforms, but only Visual Studio for Windows) but are there other
techincal/syntatical/standard library function differences?

Johs

Yes. Anything that passes file paths to the OS. Watch our for the
direction of slashes and drive letters.

This is all OS dependent so you need to count for it.


Adrian
 
B

BobR

Victor Bazarov said:
IIUIC, when you practice Zen Programming, there *is* no program. Only
your awareness of it exists. :)

Does this 'Zen Programming' have as steep a learning curve as C++?
Is there an IDE for Zen, or is it all in your id(in your mind)?
 
V

Victor Bazarov

BobR said:
Does this 'Zen Programming' have as steep a learning curve as C++?
Is there an IDE for Zen, or is it all in your id(in your mind)?

A young man once came to a Zen Programming teacher and said, "Guru,
how long would it take me to learn Zen Programming?". The teacher
said, "Ten years". "What if I study really hard and do all the
exercises? How long would it take then?" The teacher said,
"Twenty years".

V
 
J

James Kanze

and this information where does it comes from?

Personal observation.
and easy to keep in mind. That is, if I don't remember something that I
don't use every day, I can expect to find it quite quickly.

Maybe that's the difference. I develop code on a daily basis,
and remembering things I use on a daily basis isn't difficult.
I do use a graphical interface with the debugger, for example,
because that's a tool I'll only use a couple of times a year.
On the other hand, I'm sitting in front of the keyboard many
hours most days, so learning to touch type was worth the effort:
it took time to learn, but that time has more than repaid itself
since.
there is no doubt.
oh, well. It depends, actually. Probably if you are able to keep in mind
every shortcut in vim, every syntax rule of your makefiles and
everything yuo wrote in them, etc, probably it is true.

Makefiles can be a problem, but they are generally only written
once, then included. And from what I have seen of Visual
Studios, the only real difference is that you have to enter the
text in 100's of little pop-up windows, instead of once in a
makefile; the default configurations in Visual Studios (and in
every other tool I've seen, GUI or otherwise) are pretty much
useless.
But if you have
to remove a specific warning or defining a preprocessor symbol in a
specific compilation unit, just for example, and you have a makefile
that you have written long time ago, or you don't have written at all,
because in the real world you don't work just with your code, I think
that a left click of the mouse and a check into a box would be faster
than looking for the appropriate makefile, find the compilation unit,
hope that is written in such a way you can specify a rule for each
compilation unit, and then add the command that you have to keep in mind
anyway in order not to have to look at the manpage of gcc.

The problem is that you probably want to retrofit this change
into all of the other makefiles you use. I use GNU make, and my
local makefiles just define a few variables and include a global
one (which has become very complicated over time); any such
modifications go into the global makefile (or a sub-makefile
included from it, e.g. depending on the compiler or the target
system).

This seems to be a widespread technique; at least, I've seen it
a number of times.
It's the same principle why it's easier exploring a program during the
debug through the IDE, moving through the program stack by clicking on
the single functions, keeping under control multiple variables in a
subwindow, than keeping in mind thousand of "bt", "sb" (I think) and
other obfuscated gdb commands.

For the debugger, I agree. Because it's a tool that you'll
normally only use two or three times a year. (About the only
exception would be for post mortems, and how much effort does it
take to remember the single command bt?)
 
J

James Kanze

Even if you stick to standard C++ paths to any file access
functions are system dependent. The one thing I would watch out for is
the \ and / in file paths and drive letters.

Even whether there are paths is system dependent, but on all the
systems I've seen which supported nested directories, '/' has
worked as a path separator. I generally use it for internal
paths, map to a preferred path separator (either '/' or '\\' for
pathnames which will be passed to other programs or displayed to
the user), and accept anything in a list of separators (either
"/" or "/\\") on input.
 

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

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top