Discussion:
STL bitset class slow..
(too old to reply)
crea
2011-03-04 07:41:48 UTC
Permalink
How come STL library class is slower than normal C-code? I read from
somewhere that STL classes (vectors) are optmized for performance, so best
to use them. But I did a test and bitset failed.

I made a C-code and then the same with bitset class. C-code did the job in 2
seconds but bitset in 14 seconds. Quite a difference.

Really true that bitset -class is slow? I was thinking of using it , but I
need it to be very fast. If its this slow I cannot use it...

Code:
Test 1; C-version:

int n = 10001;
for(int i=0; i<1000000000;i++)
{
n |= i; // bit-or operation
}

Test 2; STL-version:

bitset<32> bi;
bitset<32> bi2;
for(int i=0; i<1000000000;i++)
{
bi |= bi2;
}
Miles Bader
2011-03-04 08:14:31 UTC
Permalink
Post by crea
How come STL library class is slower than normal C-code? I read from
somewhere that STL classes (vectors) are optmized for performance, so
best to use them. But I did a test and bitset failed.
You didn't specify your compiler, environment, or options used, so it's
hard to say.

I tried compiling the following program using g++-4.6, and it produced
identical code for "int" and "bitset<32>":

#include <bitset>

using namespace std;

int test_int ()
{
int n = 10001;
for(int i=0; i<1000000000;i++)
n |= i; // bit-or operation
return n;
}

bitset<32> test_bitset ()
{
bitset<32> bi (10001);
for(int i=0; i<1000000000;i++)
bi |= bitset<32> (i);
return bi;
}

Here's the result:

$ g++-4.6 -o - -S -march=native -O2 x.cc |cleanasm

.globl test_int()
test_int():
xorl %edx, %edx
movl $10001, %eax
.L2:
orl %edx, %eax
addl $1, %edx
cmpl $1000000000, %edx
jne .L2
rep
ret

.globl test_bitset()
test_bitset():
xorl %edx, %edx
movl $10001, %eax
.L6:
orq %rdx, %rax
addq $1, %rdx
cmpq $1000000000, %rdx
jne .L6
rep
ret

.ident "GCC: (Debian 4.6-20110216-1) 4.6.0 20110216 (experimental) [trunk revision 170225]"
--
`There are more things in heaven and earth, Horatio,
Than are dreamt of in your philosophy.'
crea
2011-03-04 11:39:52 UTC
Permalink
Post by Miles Bader
Post by crea
How come STL library class is slower than normal C-code? I read from
somewhere that STL classes (vectors) are optmized for performance, so
best to use them. But I did a test and bitset failed.
You didn't specify your compiler, environment, or options used, so it's
hard to say.
True, I forgot the optimization issue.... I use VC6++. I need to do the same
without optimization.
red floyd
2011-03-04 16:33:19 UTC
Permalink
[redacted]
Post by crea
True, I forgot the optimization issue.... I use VC6++. I need to do the same
without optimization.
VC6 is horrendously out of date, and predates even the 1998 standard
(much less
the 2003 update).

Get a *REAL* compiler. GCC is available for Windows, and VS2010
Express is
is available for free.
crea
2011-03-04 17:45:27 UTC
Permalink
Post by red floyd
[redacted]
Post by crea
True, I forgot the optimization issue.... I use VC6++. I need to do
the same without optimization.
VC6 is horrendously out of date, and predates even the 1998 standard
(much less
the 2003 update).
Get a *REAL* compiler. GCC is available for Windows, and VS2010
Express is
is available for free.
The problem is, I think, they dont have proper graphical programming
possibilities, which VC6 has. I need graphics as well!! Express does not
have included...
crea
2011-03-04 17:46:52 UTC
Permalink
Post by crea
Post by red floyd
[redacted]
Post by crea
True, I forgot the optimization issue.... I use VC6++. I need to do
the same without optimization.
VC6 is horrendously out of date, and predates even the 1998 standard
(much less
the 2003 update).
Get a *REAL* compiler. GCC is available for Windows, and VS2010
Express is
is available for free.
The problem is, I think, they dont have proper graphical programming
possibilities, which VC6 has. I need graphics as well!! Express does
not have included...
The problem is that I have learned to use MFC. So these dont have it... its
a bit difficult to change.
Dombo
2011-03-04 18:54:40 UTC
Permalink
Post by crea
Post by crea
Post by red floyd
[redacted]
Post by crea
True, I forgot the optimization issue.... I use VC6++. I need to do
the same without optimization.
VC6 is horrendously out of date, and predates even the 1998 standard
(much less
the 2003 update).
Get a *REAL* compiler. GCC is available for Windows, and VS2010
Express is
is available for free.
The problem is, I think, they dont have proper graphical programming
possibilities, which VC6 has. I need graphics as well!! Express does
not have included...
The problem is that I have learned to use MFC. So these dont have it... its
a bit difficult to change.
Only the Express editions don't come with MFC. The other editions of
Visual Studio do include MFC (and ATL).
crea
2011-03-04 17:53:08 UTC
Permalink
Post by red floyd
[redacted]
Post by crea
True, I forgot the optimization issue.... I use VC6++. I need to do
the same without optimization.
VC6 is horrendously out of date, and predates even the 1998 standard
(much less
the 2003 update).
Get a *REAL* compiler. GCC is available for Windows, and VS2010
Express is
is available for free.
Ok, you got me thinking... let me check that GCC if it can do Win programs.
I doubt though... but lets see.
Marcel Müller
2011-03-04 18:02:27 UTC
Permalink
Hi,
Post by crea
Post by red floyd
Get a *REAL* compiler. GCC is available for Windows, and VS2010
Express is
is available for free.
Ok, you got me thinking... let me check that GCC if it can do Win programs.
I doubt though... but lets see.
if you think about gcc, you will most likely need an additional IDE. I
would recommend Eclipse CDT (free). It will outperform the VC6 IDE by far.
Of course, gcc will not support MFC, because of license issues. (An
advantage, in my opinion.)


Marcel
crea
2011-03-04 18:11:00 UTC
Permalink
Post by Marcel Müller
Hi,
Post by crea
Post by red floyd
Get a *REAL* compiler. GCC is available for Windows, and VS2010
Express is
is available for free.
Ok, you got me thinking... let me check that GCC if it can do Win
programs. I doubt though... but lets see.
if you think about gcc, you will most likely need an additional IDE. I
would recommend Eclipse CDT (free). It will outperform the VC6 IDE by
far. Of course, gcc will not support MFC, because of license issues.
(An advantage, in my opinion.)
Ok, thanks... I will check that. I ll let you know. Interesting stuff...

Professionally speaking, do you think it is a good idea to learn these after
using VC since 1996? ITs free, so is it professional?? Is it as good as
Visual Studio?
Jorgen Grahn
2011-03-04 21:13:09 UTC
Permalink
Post by crea
Post by Marcel Müller
Hi,
Post by crea
Post by red floyd
Get a *REAL* compiler. GCC is available for Windows, and VS2010
Express is
is available for free.
Ok, you got me thinking... let me check that GCC if it can do Win
programs. I doubt though... but lets see.
if you think about gcc, you will most likely need an additional IDE. I
would recommend Eclipse CDT (free). It will outperform the VC6 IDE by
far. Of course, gcc will not support MFC, because of license issues.
(An advantage, in my opinion.)
Ok, thanks... I will check that. I ll let you know. Interesting stuff...
Professionally speaking, do you think it is a good idea to learn these after
using VC since 1996? ITs free, so is it professional??
In my experience (on Unix, not Windows) it's the /free/ development
tools which are professional, not the proprietary ones.

/Jorgen
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
Joshua Maurice
2011-03-05 03:34:47 UTC
Permalink
Post by Jorgen Grahn
Post by crea
Post by Marcel Müller
Hi,
Post by crea
Get a *REAL* compiler.  GCC is available for Windows, and VS2010
Express is
is available for free.
Ok, you got me thinking... let me check that GCC if it can do Win
programs. I doubt though... but lets see.
if you think about gcc, you will most likely need an additional IDE. I
would recommend Eclipse CDT (free). It will outperform the VC6 IDE by
far. Of course, gcc will not support MFC, because of license issues.
(An advantage, in my opinion.)
Ok, thanks... I will check that. I ll let you know. Interesting stuff...
Professionally speaking, do you think it is a good idea to learn these after
using VC since 1996? ITs free, so is it professional??
In my experience (on Unix, not Windows) it's the /free/ development
tools which are professional, not the proprietary ones.
As an aside, I love the visual studios IDE and especially the
integrated debugger. It beats everything I've ever seen built on top
of gdb in terms of usability and power IMHO.
James Kanze
2011-03-05 12:27:02 UTC
Permalink
On Mar 5, 3:34 am, Joshua Maurice <***@gmail.com> wrote:

[...]
Post by Joshua Maurice
As an aside, I love the visual studios IDE and especially the
integrated debugger. It beats everything I've ever seen built on top
of gdb in terms of usability and power IMHO.
Really. I find it one of the worst debuggers I've ever used.
It's constantly driving me up the wall, because I'm unable to
see what I want (where as it's filling up the screen with things
I'm not interested it).

--
James Kanze
Andre Kaufmann
2011-03-05 18:55:24 UTC
Permalink
Post by James Kanze
[...]
Post by Joshua Maurice
As an aside, I love the visual studios IDE and especially the
integrated debugger. It beats everything I've ever seen built on top
of gdb in terms of usability and power IMHO.
Really. I find it one of the worst debuggers I've ever used.
It's constantly driving me up the wall, because I'm unable to
see what I want (where as it's filling up the screen with things
I'm not interested it).
Since it's some years ago, since I had a deeper look at Unix development
tools, I wonder if there are now IDE based C++ development tools
available, besides Eclipse / KDevelop ?

Could you give an example, where a professional than Windows, Unix
debugger is easier to handle ?

(Besides ... I don't know why you make a difference between Windows /
Unix / Mac, since I thought the tools are available under all OS's?)

E.g.:

In VStudio I right click a variable - select add watch and the variable
will be displayed in the watch window, every time the debugger stops and
if the variable is visible (either globally or on the current stack).

How can that be done easier or more professional under your favorite
Unix tool.

Additionally if I add a STL variable the variable will be expanded
appropriately: E.g.: std::string s = "hello" will be displayed as

s: "hello"

in the watch window.

Don't get me wrong, I like GCC (has evolved a lot and regarding standard
conformance it's ahead of VC), but I sometimes miss the comfort of an
IDE like VStudio under Unix.
Post by James Kanze
--
James Kanze
Andre
Jorgen Grahn
2011-03-05 22:11:03 UTC
Permalink
Post by Andre Kaufmann
Post by James Kanze
[...]
Post by Joshua Maurice
As an aside, I love the visual studios IDE and especially the
integrated debugger. It beats everything I've ever seen built on top
of gdb in terms of usability and power IMHO.
Really. I find it one of the worst debuggers I've ever used.
It's constantly driving me up the wall, because I'm unable to
see what I want (where as it's filling up the screen with things
I'm not interested it).
Since it's some years ago, since I had a deeper look at Unix development
tools, I wonder if there are now IDE based C++ development tools
available, besides Eclipse / KDevelop ?
Could you give an example, where a professional than Windows, Unix
debugger is easier to handle ?
(Besides ... I don't know why you make a difference between Windows /
Unix / Mac, since I thought the tools are available under all OS's?)
I think it was me (my upthread posting) who made the distinction.
And it was simply because I don't do Windows, so I don't want to
comment on it.

(Also, I'm one of those who don't use debuggers to step through
programs. I just use gdb for post-mortem debugging. And I don't see
the point with IDEs beyond what Emacs does. But those topics have been
beaten to death here many times already.)

/Jorgen
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
Dombo
2011-03-06 08:40:28 UTC
Permalink
Post by Andre Kaufmann
[...]
Post by Joshua Maurice
As an aside, I love the visual studios IDE and especially the
integrated debugger. It beats everything I've ever seen built on top
of gdb in terms of usability and power IMHO.
Really. I find it one of the worst debuggers I've ever used.
It's constantly driving me up the wall, because I'm unable to
see what I want (where as it's filling up the screen with things
I'm not interested it).
Since it's some years ago, since I had a deeper look at Unix development
tools, I wonder if there are now IDE based C++ development tools
available, besides Eclipse / KDevelop ?
Could you give an example, where a professional than Windows, Unix
debugger is easier to handle ?
(Besides ... I don't know why you make a difference between Windows /
Unix / Mac, since I thought the tools are available under all OS's?)
In VStudio I right click a variable - select add watch and the variable
will be displayed in the watch window, every time the debugger stops and
if the variable is visible (either globally or on the current stack).
Or just let the mouse pointer hover near a variable name in your source
and it shows its current value. Over the years I have had very few
issues with Visual Studio debugger; I wonder how they could make things
even more simple. OTOH its editor, and specifically code completion, is
another story. Extensions like Visual Assist do exist for a reason.
Marc
2011-03-06 10:08:08 UTC
Permalink
Post by Andre Kaufmann
Additionally if I add a STL variable the variable will be expanded
appropriately: E.g.: std::string s = "hello" will be displayed as
s: "hello"
Pretty-printing of STL types is available in gdb, it uses some python
scripts (the STL one is shipped with libstdc++) so you can add
pretty-printers for your own types if you want to. So I guess it is
available in IDEs as well.
Andre Kaufmann
2011-03-07 08:21:02 UTC
Permalink
Post by Marc
Post by Andre Kaufmann
Additionally if I add a STL variable the variable will be expanded
appropriately: E.g.: std::string s = "hello" will be displayed as
s: "hello"
Pretty-printing of STL types is available in gdb, it uses some python
scripts (the STL one is shipped with libstdc++) so you can add
pretty-printers for your own types if you want to. So I guess it is
available in IDEs as well.
I not used this extensions by myself, but what I read from the
documentation, that there are commands for each STL container, so you
have to know if it's a list, a map etc.

Is there an option to pretty-print each stl container, without knowing
it's exact type ?

Andre
James Kanze
2011-03-06 12:36:27 UTC
Permalink
Post by Andre Kaufmann
Post by James Kanze
[...]
Post by Joshua Maurice
As an aside, I love the visual studios IDE and especially the
integrated debugger. It beats everything I've ever seen built on top
of gdb in terms of usability and power IMHO.
Really. I find it one of the worst debuggers I've ever used.
It's constantly driving me up the wall, because I'm unable to
see what I want (where as it's filling up the screen with things
I'm not interested it).
Since it's some years ago, since I had a deeper look at Unix development
tools, I wonder if there are now IDE based C++ development tools
available, besides Eclipse / KDevelop ?
I don't know. All of the IDE's I've used (especially Visual
Studios, but that may be only because I've used it much more
than the others) have been very counter productive. Even when
developing under Windows, may primary development environment is
vim/bash/msbuild. About the only time I do use an IDE is when I
go into the debugger, which isn't that often. (Under Unix, I
use it even less, because tools like valgrind are often more
effective.)
Post by Andre Kaufmann
Could you give an example, where a professional than Windows, Unix
debugger is easier to handle ?
What do you mean by "easier to handle"? For most things, most
of the IDE debuggers are pretty much equivalent. There are
things that the Unix debuggers do better, but generally, their
big advantage is that they are based on a more powerful
debugger, and have a command window which allows using it.
Things like setting breakpoints, getting a stack walkback, and
continuing from a breakpoint are about the same with all
debuggers I've used. On the other hand, gdb will always show
the return value when stepping out of a function, and it's easy
to display an arbitrary expression with gdb---it's much more
painful with the MS debugger. As it happens, those are two of
the most frequent things I need when debugging live code. (One
of the most frequent uses of a debugger under Unix is post
mortem debugging. Which isn't possible under Windows, but
that's not the fault of the debugger.)
Post by Andre Kaufmann
(Besides ... I don't know why you make a difference between
Windows / Unix / Mac, since I thought the tools are available
under all OS's?)
Debuggers are linked with the build chain tool set. Gdb is
available under Windows, but it isn't effective for debugging
programs compiled using VS.
Post by Andre Kaufmann
In VStudio I right click a variable - select add watch and the variable
will be displayed in the watch window, every time the debugger stops and
if the variable is visible (either globally or on the current stack).
And you get a completely new window, hogging up screen space, so
you have to dock it and resize it very small (since all your
interested in is one variable). And of course, a lot of the
time, you want an expression that is more complicated than just
a simple variable, and most of the time, you really only want it
once. Doesn't matter, you need to go through I don't know how
many menus, open up a new watchpoint window, then go into it,
and type the expression. And then dismiss the window.
Post by Andre Kaufmann
How can that be done easier or more professional under your favorite
Unix tool.
Just type in "disp <expr>" under gdb. For any arbitrary
expression. "disp " is less keystrokes than you need mouse
clicks to open a watch window, and you don't even have to take
your hands off the keyboard.
Post by Andre Kaufmann
Additionally if I add a STL variable the variable will be expanded
appropriately: E.g.: std::string s = "hello" will be displayed as
s: "hello"
in the watch window.
Not in the configuration I'm using. But both in VS and gdb, you
can configure it to do so, using plugins (VS) or scripts (gdb).
Post by Andre Kaufmann
Don't get me wrong, I like GCC (has evolved a lot and
regarding standard conformance it's ahead of VC), but I
sometimes miss the comfort of an IDE like VStudio under Unix.
I currently develop mainly under Windows, and I regret having to
use an IDE for some things. It slows me down considerably.

--
James Kanze
Öö Tiib
2011-03-06 14:24:38 UTC
Permalink
Post by James Kanze
(One
of the most frequent uses of a debugger under Unix is post
mortem debugging.  Which isn't possible under Windows, but
that's not the fault of the debugger.)
Post-mortem debugger "Dr. Watson" has been available under Windows
like for two decades ... i think. The Windows tools are certainly not
worse than anywhere else, but setting them up is not so easy.

MS itself writes major stuff in C++ so they need and so there are good
tools. From others they expect C# so the C++ tools are delivered to
audience bundled into pieces of shit they call "toolset"s, "API"s,
"development kit"s etc. Better tools are perhaps integrated into their
most expensive version of visual studio. Some are not integrated at
all. Normal Windows developer has therefore to download various pieces
from Microsoft site and salvage, combine and integrate the tools from
these to get viable toolset for development.
Andre Kaufmann
2011-03-07 08:02:40 UTC
Permalink
Post by James Kanze
[...]
I don't know. All of the IDE's I've used (especially Visual
Studios, but that may be only because I've used it much more
than the others) have been very counter productive. Even when
developing under Windows, may primary development environment is
vim/bash/msbuild. About the only time I do use an IDE is when I
go into the debugger, which isn't that often. (Under Unix, I
use it even less, because tools like valgrind are often more
effective.)
Well, I think there are basically 2 kinds of developers. One group likes
IDE based development more, one console based development.

Since I like IDE based development, I don't care that much about using
vim/vi etc., though I like the speed of command line tools.
I tried to use such tools too, but I frequently forget the command line
instructions of the debugger / compiler and therefore deal more with
reading documentation than writing source code.

Drivers, for example, are developed under Windows from the command line
too. (there must be many former Unix/VMS developers doing core
development at Microsoft ;-) )
Post by James Kanze
Post by Andre Kaufmann
Could you give an example, where a professional than Windows, Unix
debugger is easier to handle ?
What do you mean by "easier to handle"? For most things, most
of the IDE debuggers are pretty much equivalent. There are
things that the Unix debuggers do better, but generally, their
big advantage is that they are based on a more powerful
debugger, and have a command window which allows using it.
There is an immediate mode in the IDE and for example the free Windows
Debugger is more command line centric (and much more powerful than the
one shipped with VStudio - but IMHO more complex to understand, since
there are much more commands to know - just like in GDB)

I sometimes have the impression, that developers in both "worlds" (Unix,
Windows) don't know that much about the "other world". I frequently try
to be up to date what's going on under Linux (Unix) regarding
development tools. But unfortunately, getting a deep knowledge about the
development tools needs just too much time.

I too like the speed of command line tools, but I miss the comfort of
the IDE, so I prefer IDEs and "live" with some downsides.
Post by James Kanze
Things like setting breakpoints, getting a stack walkback, and
continuing from a breakpoint are about the same with all
debuggers I've used. On the other hand, gdb will always show
the return value when stepping out of a function,
The MS debugger (all of them I know) shows the return values too.
Post by James Kanze
and it's easy
to display an arbitrary expression with gdb---it's much more
painful with the MS debugger. As it happens, those are two of
the most frequent things I need when debugging live code. (One
of the most frequent uses of a debugger under Unix is post
mortem debugging. Which isn't possible under Windows, but
that's not the fault of the debugger.)
Well, I know that argument. I'm told this frequently and Unix developers
are then astonished, when I tell them that post mortem debugging is
built in the OS for years (at least in all Windows NT operating systems).

It's Windows Error Reporting, former Dr. Watson., which takes a snapshot
and optionally sends the dump to a server to Microsoft.
Normally such dumps are not saved (if there are no OS specific
informations about the crash). A company can register it's applications
and download crash information from a Microsoft server.

But the "more professional" users surely don't like information to be
sent to a server, so for example I've implemented my own crash handler
in our application.

With this crash handler we are able to send information to our servers
or optionally

get a live debugging dump (same as the crash dump).

This is quite handy to debug deadlocks (where no crash dump is written).

It's even possible to connect with Visual Studio directly to our
applications and directly debug the snapshot in the IDE. (if we are
allowed too, since it's disabled by default, and know the password for
the system)
Post by James Kanze
Post by Andre Kaufmann
(Besides ... I don't know why you make a difference between
Windows / Unix / Mac, since I thought the tools are available
under all OS's?)
Debuggers are linked with the build chain tool set.
Yes, but there are multiple debuggers.

If you like GDB, then you perhaps like the (free) Microsoft Windows
Debugger for debugging Windows VStudio compiled applications, since IMHO
it's comparable with GDB (though it's too using Windows, but is more
command line centric)
Post by James Kanze
Gdb is
available under Windows, but it isn't effective for debugging
programs compiled using VS.
I didn't use GDB for Windows that much. But I think it doesn't support
PDB debugging file format, so I agree it's you can't professionally
debug Windows applications compiled with VStudio with GDB.

But I think the reason for that is that there's no standard (no one
which is used for all operating systems) for C++ ABI and debugging
information.
Post by James Kanze
Post by Andre Kaufmann
In VStudio I right click a variable - select add watch and the variable
will be displayed in the watch window, every time the debugger stops and
if the variable is visible (either globally or on the current stack).
And you get a completely new window, hogging up screen space, so
You have different options:

- Hover with the mouse pointer over the variable: Output is displayed
in a small popup

- Add watch: Variable will be added to a >single< watch window

- Add quick watch: Opens a new window (as you described)

- Pin to source: Add a small watch window directly in the source
(which I find quite cool - since the information is only displayed
when and where needed)

- Use the "command line immediate window" and enter
? variable
to get the value.
Post by James Kanze
you have to dock it and resize it very small (since all your
interested in is one variable).
It's the option "add quick watch" which opens such a Window. I don't
like this option too and I prefer the other ones, I listed above.
Post by James Kanze
Post by Andre Kaufmann
How can that be done easier or more professional under your favorite
Unix tool.
Just type in "disp<expr>" under gdb. For any arbitrary
expression. "disp " is less keystrokes than you need mouse
clicks to open a watch window, and you don't even have to take
your hands off the keyboard.
I wonder why this is more complex than entering: ?<expr> in the
immediate window?
Post by James Kanze
Post by Andre Kaufmann
Additionally if I add a STL variable the variable will be expanded
appropriately: E.g.: std::string s = "hello" will be displayed as
s: "hello"
in the watch window.
Not in the configuration I'm using. But both in VS and gdb, you
can configure it to do so, using plugins (VS) or scripts (gdb).
My version I'm using (2008/2010) is displaying STL objects expanded
nicely by default.
Post by James Kanze
Post by Andre Kaufmann
Don't get me wrong, I like GCC (has evolved a lot and
regarding standard conformance it's ahead of VC), but I
sometimes miss the comfort of an IDE like VStudio under Unix.
I currently develop mainly under Windows, and I regret having to
use an IDE for some things. It slows me down considerably.
The new tool chain, VC 2010, is based on MSBuild completely. So using a
text editor and Windows Debugger command line based developing should be
possible too (with all compilers).
But since this is not main stream (as under Unix) I don't think it's a
good way to go.
Post by James Kanze
James Kanze
Andre
Jorgen Grahn
2011-03-07 10:29:37 UTC
Permalink
Post by Andre Kaufmann
Post by James Kanze
[...]
I don't know. All of the IDE's I've used (especially Visual
Studios, but that may be only because I've used it much more
than the others) have been very counter productive. Even when
developing under Windows, may primary development environment is
vim/bash/msbuild. About the only time I do use an IDE is when I
go into the debugger, which isn't that often. (Under Unix, I
use it even less, because tools like valgrind are often more
effective.)
Well, I think there are basically 2 kinds of developers. One group likes
IDE based development more, one console based development.
Since I like IDE based development, I don't care that much about using
vim/vi etc., though I like the speed of command line tools.
I tried to use such tools too, but I frequently forget the command line
instructions of the debugger / compiler and therefore deal more with
reading documentation than writing source code.
But that's not how you do it! You use your shell's/application's
history feature to search back in case you have forgotten the exact
command-line for doing something.

And you almost never run the compiler yourself -- you write a Makefile
(or equivalent) which contains the details of how to build.

And finally, since you speak about "console-based": it's not a
distinction between a full-blown IDE and a single 1970s terminal --
every programmer I know uses a windowing system, and graphical tools.

...
Post by Andre Kaufmann
I sometimes have the impression, that developers in both "worlds" (Unix,
Windows) don't know that much about the "other world".
That is a fact. I'm sure I haven't understood the attraction of IDEs
myself.

/Jorgen
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
Andre Kaufmann
2011-03-08 21:41:13 UTC
Permalink
Post by Jorgen Grahn
And you almost never run the compiler yourself -- you write a Makefile
(or equivalent) which contains the details of how to build.
Yes, but I don't get it what's the advantage of:

a) Add files in a text editor to a makefile, set the compiler
switches etc (or optionally use a graphical tool)

b) Let the IDE handle the makefile -> add files with graphical tools,
set the compiler switches with graphical tools and then get a
project file which can be optionally built from a command line

So where is the advantage of a) over b) ?

Andre
red floyd
2011-03-08 23:54:59 UTC
Permalink
Post by Andre Kaufmann
Post by Jorgen Grahn
And you almost never run the compiler yourself -- you write a Makefile
(or equivalent) which contains the details of how to build.
a) Add files in a text editor to a makefile, set the compiler
    switches etc (or optionally use a graphical tool)
b) Let the IDE handle the makefile -> add files with graphical tools,
    set the compiler switches with graphical tools and then get a
    project file which can be optionally built from a command line
So where is the advantage of a) over b) ?
In an IDE, you can only do what the IDE lets you do
(*cough*VisualStudio*cough*).
In a Makefile, you can do whatever you want.
Andre Kaufmann
2011-03-09 16:48:14 UTC
Permalink
Post by red floyd
[...]
Post by Andre Kaufmann
So where is the advantage of a) over b) ?
In an IDE, you can only do what the IDE lets you do
(*cough*VisualStudio*cough*).
LOL - I don't care about such arguments - and I don't waste time and
energy for that.

I'm open to other tools and operating systems and want to learn and know
each of them, unfortunately there isn't enough time to do that at expert
level.
Post by red floyd
In a Makefile, you can do whatever you want.
Could you give me an illustrative example ?

My argument is the IDE (there are several ones - even under Unix) is
just a tool to handle the makefiles. You can choose whatever you want.
The makefile standard format for Windows is MsBuild.

You can edit the makefiles from VIM >> or << from the IDE.

So I can do whatever I want from the command line + the IDE.

And besides that, the IDE can be configured individually and supports a
plugin system, where you can do >different< things than from the command
line.

Additionally editing a GUI, Profiler, UML Tools - what you see is what
you get style tools - is IMHO impossible from VIM.
If a developer uses non visual GUI programming, then it's o.k to use VIM
- it's a different development style and architecture.
Different doesn't IMHO mean better or worse.

Just like comparing TEX <-> Open Office :-9

Andre
red floyd
2011-03-09 18:14:22 UTC
Permalink
Post by Andre Kaufmann
Post by red floyd
[...]
Post by Andre Kaufmann
So where is the advantage of a) over b) ?
In an IDE, you can only do what the IDE lets you do
(*cough*VisualStudio*cough*).
LOL - I don't care about such arguments - and I don't waste time and
energy for that.
I'm open to other tools and operating systems and want to learn and know
each of them, unfortunately there isn't enough time to do that at expert
level.
Post by red floyd
In a Makefile, you can do whatever you want.
Could you give me an illustrative example ?
Anything that requires a "custom build" step. It's horribly broken
in VS.

Anything that isn't stock compile/link

Or something that builds two targets. In VS, you need to have
multiple projects to do that.


-- Makefile

exefile : main.o table.o
$(CC) -o exefile main.o table.o

main.o : main.c

table.o : table.c

table.c : tabledata.txt
preprocess human readable tabledata.txt into table.c
Andre Kaufmann
2011-03-12 06:52:00 UTC
Permalink
Post by red floyd
[...]
Post by Andre Kaufmann
Could you give me an illustrative example ?
Anything that requires a "custom build" step. It's horribly broken
in VS.
Thank you for the example.
I used it quite frequently and it has changed a lot in VStudio 2010.
Post by red floyd
Anything that isn't stock compile/link
Or something that builds two targets. In VS, you need to have
multiple projects to do that.
Do you mean multiple executables or multiple code targets generated by
one "custom build step". If the latter then yes I miss that too. You can
generate multiple outputs but AFAIK only one output file can be tracked
if a rebuild is necessary or not.
Post by red floyd
-- Makefile
exefile : main.o table.o
$(CC) -o exefile main.o table.o
main.o : main.c
table.o : table.c
table.c : tabledata.txt
preprocess human readable tabledata.txt into table.c
The MSBuild equivalent would be (removed project conditions):
[ please don't let start a discussion if flat makefiles are more
readable as XML makefiles - they are ;-) ]

<ItemGroup>
<ClCompile Include="Main.cpp"/>
<ClCompile Include="Table.cpp"/>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="TableData.txt">
<Command>
createSource.exe %(FullPath) $(ProjectDir)\Table.cpp
</Command>
<Message>
Generating $(ProjectDir)\Table.cpp
</Message>
<Outputs>
$(ProjectDir)\Table.cpp
</Outputs>
</CustomBuild>
</ItemGroup>

Andre
Paavo Helde
2011-03-09 18:41:13 UTC
Permalink
Post by Andre Kaufmann
Post by red floyd
[...]
Post by Andre Kaufmann
So where is the advantage of a) over b) ?
In an IDE, you can only do what the IDE lets you do
(*cough*VisualStudio*cough*).
LOL - I don't care about such arguments - and I don't waste time and
energy for that.
I'm open to other tools and operating systems and want to learn and know
each of them, unfortunately there isn't enough time to do that at expert
level.
Post by red floyd
In a Makefile, you can do whatever you want.
Could you give me an illustrative example ?
Specifying common behavior for multiple projects. With makefiles, you
just include another makefile. With MS .vcproj, this was a major pain. In
VS2005 they introduced the system of property sheets which should do
exactly that. However, while they support fine-tuned filters and flexible
combinations of settings for different levels, this is not really
achievable through their dialog-based IDE. The property sheet language is
nowhere documented of course. The best approach seems to be to start with
entering settings in the IDE to learn the needed syntax and property
names, then clean up the resulting mess and adjust filter conditions in a
text editor.

Cheers
Paavo
Jorgen Grahn
2011-03-09 18:56:36 UTC
Permalink
Post by Andre Kaufmann
Post by Jorgen Grahn
And you almost never run the compiler yourself -- you write a Makefile
(or equivalent) which contains the details of how to build.
a) Add files in a text editor to a makefile, set the compiler
switches etc (or optionally use a graphical tool)
b) Let the IDE handle the makefile -> add files with graphical tools,
set the compiler switches with graphical tools and then get a
project file which can be optionally built from a command line
So where is the advantage of a) over b) ?
Just to mention a few:

It's standard, and it's open-ended. It's not tied to any specific IDE,
or to any specific programming language or even to any specific task.

/Jorgen
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
James Kanze
2011-03-09 21:57:34 UTC
Permalink
Post by Andre Kaufmann
Post by Jorgen Grahn
And you almost never run the compiler yourself -- you write a Makefile
(or equivalent) which contains the details of how to build.
a) Add files in a text editor to a makefile, set the compiler
switches etc (or optionally use a graphical tool)
b) Let the IDE handle the makefile -> add files with graphical tools,
set the compiler switches with graphical tools and then get a
project file which can be optionally built from a command line
So where is the advantage of a) over b) ?
You get what you want, in a format which can easily be
copy/pasted to other projects.

In practice, in large companies, your makefile will just define
a couple of macros (e.g. sources = ...), then include some
global makefile, so you automatically get the standard compiler
options for your shop. And don't have to go through all of your
project files changing them if they change.

There's also the fact that make (or at least the ones I've used)
handle dependencies correctly. VS 2005 doesn't, and if you just
do build, you often end up not recompiling files that need it.

--
James Kanze
Andre Kaufmann
2011-03-12 07:03:45 UTC
Permalink
Post by James Kanze
[...]
You get what you want, in a format which can easily be
copy/pasted to other projects.

Agreed. For such tasks and complex builds I don't use VStudio too.
For complex builds I'm using FinalBuilder (since we use other IDEs and
tools which aren't supported by VStudio)
Post by James Kanze
There's also the fact that make (or at least the ones I've used)
handle dependencies correctly. VS 2005 doesn't, and if you just
do build, you often end up not recompiling files that need it.
Yes, agreed. But I would call this then a "bug" or "broken".
VS 2010 uses now MSBuild makefiles for C++ too, same as other IDE's like
CBuilder.

If the project is permanently rebuilt or some targets are not rebuilt in
this version of the IDE then the MSBuild system would be broken and it
would happen from the command line too.
Post by James Kanze
--
James Kanze
Andre
James Kanze
2011-03-07 22:11:05 UTC
Permalink
Post by Andre Kaufmann
Post by James Kanze
[...]
I don't know. All of the IDE's I've used (especially Visual
Studios, but that may be only because I've used it much more
than the others) have been very counter productive. Even when
developing under Windows, may primary development environment is
vim/bash/msbuild. About the only time I do use an IDE is when I
go into the debugger, which isn't that often. (Under Unix, I
use it even less, because tools like valgrind are often more
effective.)
Well, I think there are basically 2 kinds of developers. One group likes
IDE based development more, one console based development.
I don't think it's that simple. There are just so many things
that you can't do with an IDE; that require entering text. For
starters, if when entering source code, you had to choose each
letter from a menu, you'd soon get very frustrated. Or when
doing a global search and replace, using regular expressions:
you still have to type in the regular expression. All of this
means that most of the time, your fingers are in the base
position on the keyboard. And that you can type in about twenty
characters in the time it takes your hand to get to the mouse
and back.

I like the mouse when I'm just browsing, without any specific
goal in mind. Or when I'm dealing with a graphical
representation, like UML. Otherwise, however, I don't like
having to move my hands from the base position on the keyboard.
It costs too much in productivity.
Post by Andre Kaufmann
Since I like IDE based development, I don't care that much about using
vim/vi etc., though I like the speed of command line tools.
I tried to use such tools too, but I frequently forget the command line
instructions of the debugger / compiler and therefore deal more with
reading documentation than writing source code.
In the case of the debugger, I'm often in the same case, because
I don't use it that often. Still, typing in "help" takes less
time than searching through untold menus.
Post by Andre Kaufmann
Drivers, for example, are developed under Windows from the
command line too. (there must be many former Unix/VMS
developers doing core development at Microsoft ;-) )
Post by James Kanze
Post by Andre Kaufmann
Could you give an example, where a professional than Windows, Unix
debugger is easier to handle ?
What do you mean by "easier to handle"? For most things, most
of the IDE debuggers are pretty much equivalent. There are
things that the Unix debuggers do better, but generally, their
big advantage is that they are based on a more powerful
debugger, and have a command window which allows using it.
There is an immediate mode in the IDE and for example the free
Windows Debugger is more command line centric (and much more
powerful than the one shipped with VStudio - but IMHO more
complex to understand, since there are much more commands to
know - just like in GDB)
I sometimes have the impression, that developers in both
"worlds" (Unix, Windows) don't know that much about the "other
world". I frequently try to be up to date what's going on
under Linux (Unix) regarding development tools. But
unfortunately, getting a deep knowledge about the development
tools needs just too much time.
I used to think that was true. And since I've been working
under Windows, some things have surprised me. But although I'm
beginning to know (and understand) the Windows world, I'm still
far more productive under Unix. And that's true for the vast
majority of programmers I've worked with.
Post by Andre Kaufmann
I too like the speed of command line tools, but I miss the comfort of
the IDE, so I prefer IDEs and "live" with some downsides.
Post by James Kanze
Things like setting breakpoints, getting a stack walkback, and
continuing from a breakpoint are about the same with all
debuggers I've used. On the other hand, gdb will always show
the return value when stepping out of a function,
The MS debugger (all of them I know) shows the return values too.
Sometimes. Sometimes not. I've not been able to make it show
them systematically, everytime I step out of a function. And
since I use a fairly functional style of programming a lot,
that's a killer in my book.
Post by Andre Kaufmann
Post by James Kanze
and it's easy
to display an arbitrary expression with gdb---it's much more
painful with the MS debugger. As it happens, those are two of
the most frequent things I need when debugging live code. (One
of the most frequent uses of a debugger under Unix is post
mortem debugging. Which isn't possible under Windows, but
that's not the fault of the debugger.)
Well, I know that argument. I'm told this frequently and Unix developers
are then astonished, when I tell them that post mortem debugging is
built in the OS for years (at least in all Windows NT operating systems).
I'm glad to hear it. But where does it put the core dump. And
why don't any of the Windows specialists where I work know about
it.
Post by Andre Kaufmann
It's Windows Error Reporting, former Dr. Watson., which takes a snapshot
and optionally sends the dump to a server to Microsoft.
Normally such dumps are not saved (if there are no OS specific
informations about the crash). A company can register it's applications
and download crash information from a Microsoft server.
You mean I have to go through Microsoft to get a core dump?
Post by Andre Kaufmann
But the "more professional" users surely don't like information to be
sent to a server, so for example I've implemented my own crash handler
in our application.
With this crash handler we are able to send information to our
servers or optionally get a live debugging dump (same as the
crash dump).
This is quite handy to debug deadlocks (where no crash dump is
written).
Unless you send the program a signal to tell it to crash:-).
Post by Andre Kaufmann
It's even possible to connect with Visual Studio directly to our
applications and directly debug the snapshot in the IDE. (if we are
allowed too, since it's disabled by default, and know the password for
the system)
And the crash happens on your machine, and not the user's (where
no Visual Studios is installed).
Post by Andre Kaufmann
Post by James Kanze
Gdb is
available under Windows, but it isn't effective for debugging
programs compiled using VS.
I didn't use GDB for Windows that much. But I think it doesn't support
PDB debugging file format, so I agree it's you can't professionally
debug Windows applications compiled with VStudio with GDB.
But I think the reason for that is that there's no standard (no one
which is used for all operating systems) for C++ ABI and debugging
information.
Definitely. Even under Solaris, I'd use Sun's debugger with Sun
OS, and gdb with g++. Which is a pain.
Post by Andre Kaufmann
Post by James Kanze
Post by Andre Kaufmann
In VStudio I right click a variable - select add watch and the variable
will be displayed in the watch window, every time the debugger stops and
if the variable is visible (either globally or on the current stack).
And you get a completely new window, hogging up screen space, so
- Hover with the mouse pointer over the variable: Output is displayed
in a small popup
I'm rarely interested in a variable; I want an expression. (As
I said, my style is often functional, and there just aren't many
variables.)
Post by Andre Kaufmann
- Add watch: Variable will be added to a >single< watch window
- Add quick watch: Opens a new window (as you described)
- Pin to source: Add a small watch window directly in the source
(which I find quite cool - since the information is only displayed
when and where needed)
- Use the "command line immediate window" and enter
? variable
to get the value.
That's the one I didn't know. How do you activate it, and can I
enter an arbitrary expression?
Post by Andre Kaufmann
Post by James Kanze
you have to dock it and resize it very small (since all your
interested in is one variable).
It's the option "add quick watch" which opens such a Window. I don't
like this option too and I prefer the other ones, I listed above.
Post by James Kanze
Post by Andre Kaufmann
How can that be done easier or more professional under your favorite
Unix tool.
Just type in "disp<expr>" under gdb. For any arbitrary
expression. "disp " is less keystrokes than you need mouse
clicks to open a watch window, and you don't even have to take
your hands off the keyboard.
I wonder why this is more complex than entering: ?<expr> in the
immediate window?
I'll give that a try. It sounds like what I'm looking for.
Post by Andre Kaufmann
Post by James Kanze
Post by Andre Kaufmann
Additionally if I add a STL variable the variable will be expanded
appropriately: E.g.: std::string s = "hello" will be displayed as
s: "hello"
in the watch window.
Not in the configuration I'm using. But both in VS and gdb, you
can configure it to do so, using plugins (VS) or scripts (gdb).
My version I'm using (2008/2010) is displaying STL objects expanded
nicely by default.
There are some scripts which are pre-installed. I'm using 2005
(for the moment), and I don't have them. Sounds like yet
another argument to move to 2010. (They aren't lacking: for
starters, 2005 doesn't handled dependency checking correctly, so
it doesn't always recompile all of the necessary files.)
Post by Andre Kaufmann
Post by James Kanze
Post by Andre Kaufmann
Don't get me wrong, I like GCC (has evolved a lot and
regarding standard conformance it's ahead of VC), but I
sometimes miss the comfort of an IDE like VStudio under Unix.
I currently develop mainly under Windows, and I regret having to
use an IDE for some things. It slows me down considerably.
The new tool chain, VC 2010, is based on MSBuild completely.
So I've heard. And a lot of us are eager for it. Because we
need more complex build rules than are possible with the 2005
build system. (To build one of our projects, we first have to
compile an executable which generates some of the code.)
Post by Andre Kaufmann
So using a
text editor and Windows Debugger command line based developing should be
possible too (with all compilers).
But since this is not main stream (as under Unix) I don't think it's a
good way to go.
If it really works, it sounds like you'd get the best of both
worlds. Use an IDE when it's convenient, but have full access
to all of the power of the system when it's not.

As I say, we're waiting. (The technical people don't get to
make all of the decisions, and we'd have to synchronize the move
accross a number of different groups. It will come, however.)

--
James Kanze
Andre Kaufmann
2011-03-08 22:48:15 UTC
Permalink
Post by James Kanze
[...]
I like the mouse when I'm just browsing, without any specific
goal in mind. Or when I'm dealing with a graphical
representation, like UML. Otherwise, however, I don't like
having to move my hands from the base position on the keyboard.
It costs too much in productivity.
Agreed, but I don't see the difference controlling VI / VIM by keyboard
or VStudio by keyboard ? [o.k. VIM should be faster and perhaps more
responsive ;-) - but besides that point ?]
Post by James Kanze
[...]
In the case of the debugger, I'm often in the same case, because
I don't use it that often. Still, typing in "help" takes less
time than searching through untold menus.
Yes I know what you mean, though I think the browser it's commonly the
fastest tool to get any information quickly ;-) - at least under Windows.
Post by James Kanze
[...]
I used to think that was true. And since I've been working
under Windows, some things have surprised me. But although I'm
beginning to know (and understand) the Windows world, I'm still
far more productive under Unix. And that's true for the vast
majority of programmers I've worked with.
Well I think both "worlds" have evolved much and both have good tool
sets. But I think both "worlds" and tools are quite different.
Post by James Kanze
[...]
Sometimes. Sometimes not. I've not been able to make it show
them systematically, everytime I step out of a function. And
since I use a fairly functional style of programming a lot,
that's a killer in my book.
Depends, if you debug applications built with release configuration then
yes, commonly you won't see the return values, since the functions don't
exist anymore, because they have been removed by the global optimizer.
But I don't think that is different under Unix - is it ?

For debug builds I hadn't that much problems, rather with automatic stl
expansion in combination with complex template classes.
Post by James Kanze
[...]
I'm glad to hear it. But where does it put the core dump. And
There are 2 types of dumps (same format - but handling is different):

Process dumps:

Either you write it by yourself. You can register a callback function in
your application and you will get called and with a utility function you
may write the dump by yourself.
If you don't do anything Windows Error Reporting will start and the dump
files will be written to a temp directory and the dialog will list the
information which is ready to be sent to a central server.
If you have a look at the list, there should be a dump file in this list
too. This is the dump file.

These dumps can be loaded and debugged directly under Visual Studio or
Windows Debugger.


Core / System dumps: Windows BSOD - Blue Screen Of Death

Settings depend on the system. IIRC for Windows Vista and higher they
are enabled by default, under Windows XP you have to enable them.

It can be activated and the default path where it's written to can be
configured under: Right Click - My Computer - Properties - Advanced -
Startup and Recovery. Or Google "configure minidumps windows" should
give you a more detailed explanation.

These dumps can be analyzed only with Windows Debugger.
Post by James Kanze
why don't any of the Windows specialists where I work know about
it.
I don't know. Sadly only few Windows developers know dump files and how
much they can help to track errors quickly. Also there are other
compiler vendors (a famous Windows pascal compiler for example), which
don't support Microsoft Debug Format and therefore analyzing dump files
of these applications is tedious.

Most of the Windows developers try to track down errors by trying to
reproduce the problems in the IDE / debugger, but don't realize that
there's a much better and much faster way to do it.

And only few know what's the context menu in the task manager:
"Write dump file" for, when you right click an applications name in the
task manager of Windows Vista and above.


Also I have the odd feeling, that there isn't much interest too.
We had a problem with a compiler vendor (>not< Microsoft/Intel and not
Open Source) where the C++ linker crashed and we couldn't help
ourselves. We contacted the compiler vendor and he asked us to sent a
sample project (unfortunately it occurred only in our biggest
application and we weren't allowed to sent any information).
I started a discussion in the vendors newsgroup and tried to attract the
attention to other developers, which had a similar problem to vote
for dump file support (either in Microsoft format or in the compiler
vendors format).

But although it would be a huge advantage for the compiler vendor and
the developers there was zero interest in dump files and their benefits:

:-/ :-(
Post by James Kanze
Post by Andre Kaufmann
It's Windows Error Reporting, former Dr. Watson., which takes a snapshot
and optionally sends the dump to a server to Microsoft.
Normally such dumps are not saved (if there are no OS specific
informations about the crash). A company can register it's applications
and download crash information from a Microsoft server.
You mean I have to go through Microsoft to get a core dump?
You can optionally, you can register your applications and if they are
registered and any dump file is received at Microsoft it will be stored
on an server, where only the company which has developed the
applications has access too (may be you can register a server address
for the dump files to be stored on your own server - don't know for sure).

But as I wrote - you can do it by yourself.
I prefer this method, though I must admit that it's not that simple
anymore under Windows Vista / Windows 7 - you have to hook a function to
be able to be called before "Windows Error Reporting".
Not a problem for me, but for "dump file starters" for sure.
Post by James Kanze
[...]
Post by Andre Kaufmann
This is quite handy to debug deadlocks (where no crash dump is written).
Unless you send the program a signal to tell it to crash:-).
O.k. agreed - one additional possibility to get the dump ;-).
But I don't want to see a clients face and mouth if you tell him "Please
crash the application" ;-)
Post by James Kanze
And the crash happens on your machine, and not the user's (where
no Visual Studios is installed).
I just enter a http address in Visual Studio: e.g.

http:\\server:port\dump.dmp

and our application (a service) will return a snapshot dump, without
crashing the application. The application still runs and I'm able to
analyze the dump in Visual Studio.
Post by James Kanze
Post by Andre Kaufmann
Post by James Kanze
Gdb is
available under Windows, but it isn't effective for debugging
programs compiled using VS.
I didn't use GDB for Windows that much. But I think it doesn't support
PDB debugging file format, so I agree it's you can't professionally
debug Windows applications compiled with VStudio with GDB.
But I think the reason for that is that there's no standard (no one
which is used for all operating systems) for C++ ABI and debugging
information.
Definitely. Even under Solaris, I'd use Sun's debugger with Sun
OS, and gdb with g++. Which is a pain.
I'm rarely interested in a variable; I want an expression. (As
I said, my style is often functional, and there just aren't many
variables.)
Expressions are evaluated too. Complex function calls (calling C++
functions from the debugger) have either a complex syntax or aren't
possible (depends).
But due to the side effects, I wouldn't add any function call watches
anyways ;-).
Post by James Kanze
Post by Andre Kaufmann
- Use the "command line immediate window" and enter
? variable
to get the value.
That's the one I didn't know. How do you activate it, and can I
There a 2 different command windows:

1) View - Other Windows - Command Window

To be able to control the IDE from the command line (compiling etc.)

2) Immediate Window

To evaluate variables and expressions.

Either enter "immed" in the Command Window or if you debug an
application use the menu: "Debug Windows - Immediate"
or by pressing CTRL - D + I (but depends on your configuration).
Post by James Kanze
enter an arbitrary expression?
Yes, as I wrote calling functions of your application is not that simple
(name mangling :-/ and namespaces) if the function is not visible in the
current context / callstack.
But any other expressions can be evaluated without any problems (at
least the simple ones I entered - I don't use that feature extensively -
;-) ]
Post by James Kanze
[...]
If it really works, it sounds like you'd get the best of both
worlds. Use an IDE when it's convenient, but have full access
to all of the power of the system when it's not.
Yes, IMHO each developer should and can choose his own and best
developing style. Some prefer command line tools, some IDEs and some use
both.
I think both (or three) styles are equally productive - in some cases an
IDE is better in other cases command line tools are better. Depends on
the developer and the type of the application - IMHO.
Post by James Kanze
--
James Kanze
Andre
James Kanze
2011-03-09 22:14:36 UTC
Permalink
Post by Andre Kaufmann
Post by James Kanze
[...]
I like the mouse when I'm just browsing, without any specific
goal in mind. Or when I'm dealing with a graphical
representation, like UML. Otherwise, however, I don't like
having to move my hands from the base position on the keyboard.
It costs too much in productivity.
Agreed, but I don't see the difference controlling VI / VIM by keyboard
or VStudio by keyboard ? [o.k. VIM should be faster and perhaps more
responsive ;-) - but besides that point ?]
If you could control Visual Studio from the standard keyboard.
None of the experts where I work seem to be able to control it
without having to use function keys, or otherwise move their
hands from the standard position.

(Of course, there's also the issue that Visual Studio, at least
2005, is broken. It seems like I spend half my time doing full
rebuilds, because it won't compile all the object files whose
sources have changed. And I've had to create a couple of
separate, one file projects, because I need to build a small,
local program to generate part of my code.)
Post by Andre Kaufmann
Post by James Kanze
[...]
In the case of the debugger, I'm often in the same case, because
I don't use it that often. Still, typing in "help" takes less
time than searching through untold menus.
Yes I know what you mean, though I think the browser it's
commonly the fastest tool to get any information quickly ;-) -
at least under Windows.
In general, I find a GUI preferable for the tools you rarely
use, and a command line interface preferable for the ones you
regularly use: if you don't know the command, it's probably
faster searching through a well thought out menu hierarchy than
searching through the manual. So logically, I'd favor a GUI for
the debugger. But the VS debugger seems to go out of its way to
make it difficult to do one or two of the more common tasks.
(Not all of them, of course.)
Post by Andre Kaufmann
Post by James Kanze
[...]
Sometimes. Sometimes not. I've not been able to make it show
them systematically, everytime I step out of a function. And
since I use a fairly functional style of programming a lot,
that's a killer in my book.
Depends, if you debug applications built with release
configuration then yes, commonly you won't see the return
values, since the functions don't exist anymore, because they
have been removed by the global optimizer. But I don't think
that is different under Unix - is it ?
None of the debuggers are very good with optimized code. They
could all be better.
Post by Andre Kaufmann
For debug builds I hadn't that much problems, rather with
automatic stl expansion in combination with complex template
classes.
I've yet to figure out what I'm doing differently, but
sometimes, I do see the return values. Most of the times not,
however.

But I often get the feeling that the debugger is not
deterministic. Some of my work is on Excel plug-ins. For over
a year, I've been starting Excel, attaching the debugger to the
process, and debugging from there. That's the way my collegues
showed me to do it. Sometime recently, however, that stopped
working. Now I have to specify Excel as my binary, and start it
from the debugger. (On the other hand, I can still debug the
Java plug-ins by attaching to the running Java process. Va
comprendre.)

I'll have to try your other suggestions at work.

--
James Kanze
red floyd
2011-03-09 22:26:48 UTC
Permalink
Post by James Kanze
(Of course, there's also the issue that Visual Studio, at least
2005, is broken.  It seems like I spend half my time doing full
rebuilds, because it won't compile all the object files whose
sources have changed.  
I have the reverse problem. It insists that certain stuff which
hasn't changed is out of date.
Paavo Helde
2011-03-10 06:09:13 UTC
Permalink
Post by red floyd
Post by James Kanze
(Of course, there's also the issue that Visual Studio, at least
2005, is broken.  It seems like I spend half my time doing full
rebuilds, because it won't compile all the object files whose
sources have changed.  
I have the reverse problem. It insists that certain stuff which
hasn't changed is out of date.
If this is VS2010, then one reason for such behavior is to have some
nonexistant entries listed in the project, like header or resource files
which are not present any more. VS2010 keeps rebuilding the project,
apparently in the hope that this will recreate the missing files somehow.
I'm not quite sure if this is a bug or a feature.

cheers
Paavo
Öö Tiib
2011-03-10 23:19:45 UTC
Permalink
Post by James Kanze
(Of course, there's also the issue that Visual Studio, at least
2005, is broken.  It seems like I spend half my time doing full
rebuilds, because it won't compile all the object files whose
sources have changed.  
I have the reverse problem.  It insists that certain stuff which
hasn't changed is out of date.
Usually it is case when visual studio build system is unable to find
source files or dependencies (included files), however integrated
compilers manage to find them somehow. Seems that the compilers are
written by smartest people in Microsoft but IDE and build system are
outsourced to some really dumb guys. The problems go away when you
organize the source files (and #include directives) so that the dumb
IDE does not lose track.
Andre Kaufmann
2011-03-12 06:23:01 UTC
Permalink
Post by James Kanze
If you could control Visual Studio from the standard keyboard.
None of the experts where I work seem to be able to control it
without having to use function keys, or otherwise move their
hands from the standard position.
Hm, but you can assign to each function a new keystroke, or complex
macros, and there is also an emulation of emacs (free) and vim (free?)
available.
Post by James Kanze
(Of course, there's also the issue that Visual Studio, at least
2005, is broken. It seems like I spend half my time doing full
Agreed. There are situations where this happens with this rather old
version and even with the new version.
I had to activate debug outputs to track down the problem (not existing
sources). Additionally the old versions sometimes simply locked some
object files, which also lead to rebuilds.
Post by James Kanze
[...]
I've yet to figure out what I'm doing differently, but
sometimes, I do see the return values. Most of the times not,
however.
Hm, don't know for sure, since I don't use that feature that often.
Post by James Kanze
[...]
I'll have to try your other suggestions at work.
Hope they will make your development experience under (this) IDE better.
(even not as good as you are used to with a true command line tools
developer experience)

I agree that there where some bugs and problems in the older versions,
which could drive you crazy. But since in the latest version of VStudio
each language and even other tool vendors use now MSBuild format
(comparable to makefiles), when something goes wrong the command line
tools wouldn't be better (using MSBuild) and MSBuild would be broken and
not the IDE.
Post by James Kanze
--
James Kanze
Andre
Gerhard Fiedler
2011-03-17 14:34:40 UTC
Permalink
Post by Andre Kaufmann
I've yet to figure out what I'm doing differently, but sometimes, I
do see the return values. Most of the times not, however.
Hm, don't know for sure, since I don't use that feature that often.
When I step through code, I always (AFAIR) see return values in the Auto
window. Is that where you are looking?

Gerhard
Andre Kaufmann
2011-03-18 04:38:22 UTC
Permalink
Post by Gerhard Fiedler
Post by Andre Kaufmann
I've yet to figure out what I'm doing differently, but sometimes, I
do see the return values. Most of the times not, however.
Hm, don't know for sure, since I don't use that feature that often.
When I step through code, I always (AFAIR) see return values in the Auto
window. Is that where you are looking?
Gerhard
Yes, that's the feature. But I never recognized it to fail.
Perhaps if multiple return values have to be displayed. But don't know
for sure.

Andre
James Kanze
2011-03-18 23:15:43 UTC
Permalink
Post by Gerhard Fiedler
Post by Andre Kaufmann
I've yet to figure out what I'm doing differently, but sometimes, I
do see the return values. Most of the times not, however.
Hm, don't know for sure, since I don't use that feature that often.
When I step through code, I always (AFAIR) see return values in the Auto
window. Is that where you are looking?
When I see it, that's where I see it. But most of the time,
it's not there.

--
James Kanze
Dilip
2011-03-19 23:27:47 UTC
Permalink
Post by James Kanze
I'll have to try your other suggestions at work.
I assume you are talking about crash dump analysis on Windows that
Andre Kaufmann explained?
In that case you might find the following links helpful:

http://www.microsoft.com/msj/0498/bugslayer0498.aspx
http://www.wintellect.com/CS/blogs/jrobbins/archive/2008/10/21/crashfinder-2-8-yes-native-code-still-lives.aspx
James Kanze
2011-03-20 15:13:05 UTC
Permalink
Post by James Kanze
I'll have to try your other suggestions at work.
I assume you are talking about crash dump analysis on Windows that
Andre Kaufmann explained?
http://www.microsoft.com/msj/0498/bugslayer0498.aspxhttp://www.wintellect.com/CS/blogs/jrobbins/archive/2008/10/21/crashf...
Thanks. I'll forward these to my work site (where Google Groups
is blocked).

--
James Kanze
Dilip
2011-03-20 21:32:44 UTC
Permalink
Post by James Kanze
I'll have to try your other suggestions at work.
I assume you are talking about crash dump analysis on Windows that
Andre Kaufmann explained?
http://www.microsoft.com/msj/0498/bugslayer0498.aspxhttp://www.wintel......
Thanks.  I'll forward these to my work site (where Google Groups
is blocked).
--
James Kanze
I actually sent you a private email to your gmail account (the one you
are posting to Google groups with) with those links (mostly because I
was replying to a thread that was at least a couple of weeks old). Let
me know if you received them

James Kanze
2011-03-05 12:25:10 UTC
Permalink
Post by Jorgen Grahn
Post by crea
Professionally speaking, do you think it is a good idea to
learn these after using VC since 1996? ITs free, so is it
professional??
In my experience (on Unix, not Windows) it's the /free/ development
tools which are professional, not the proprietary ones.
It depends. On most platforms, the "native" development tools
(VC++ under Windows, g++ under Linux, Sun CC under Solaris,
etc.) are generally "professional". On a lot of platforms, g++
is professional, even when it isn't native, and from what I've
heard, Intel's compilers are professional as well. I don't
think you can make any blanket statements any more. (In a
fairly distant past, free generally did mean not professional,
but that's certainly not the case now.)

Also, in general, Unix tools tend to be more professional than
Windows tools, probably because Windows is the OS of choice for
non-professionals.

--
James Kanze
crea
2011-03-04 18:38:50 UTC
Permalink
Post by Marcel Müller
Hi,
Post by crea
Post by red floyd
Get a *REAL* compiler. GCC is available for Windows, and VS2010
Express is
is available for free.
Ok, you got me thinking... let me check that GCC if it can do Win
programs. I doubt though... but lets see.
if you think about gcc, you will most likely need an additional IDE. I
would recommend Eclipse CDT (free). It will outperform the VC6 IDE by far.
The only problem would be the learnig curve. Am getting a bit old (41) so
not sure if its worth to put efford to learn this new thing... or maybe just
buy latest Visual C++. Have to think about this...

I like the idea its free, because then dont need to buy new VC versions
every second year.

Of course, gcc will not support MFC, because of license issues.
Post by Marcel Müller
(An advantage, in my opinion.)
Marcel
crea
2011-03-04 18:54:54 UTC
Permalink
Post by Marcel Müller
Hi,
Post by crea
Post by red floyd
Get a *REAL* compiler. GCC is available for Windows, and VS2010
Express is
is available for free.
Ok, you got me thinking... let me check that GCC if it can do Win
programs. I doubt though... but lets see.
if you think about gcc, you will most likely need an additional IDE. I
would recommend Eclipse CDT (free). It will outperform the VC6 IDE by
far. Of course, gcc will not support MFC, because of license issues.
(An advantage, in my opinion.)
Do they have a ready installation package including everything there? I will
try to find it myself as well ... :). But if you know, pls answer yes :).
Marcel Müller
2011-03-04 19:47:59 UTC
Permalink
crea wrote:
[CDT]
Post by crea
Do they have a ready installation package including everything there? I will
try to find it myself as well ... :). But if you know, pls answer yes :).
Don't know about a single package under Windows. (The Linux package
managers don't care about such details.)
In the worst case you must install Eclispe first and the CDT-Upgrade
matching your Eclipse release (most likely Helios) second.

Look at http://www.eclipse.org/cdt/


Marcel
crea
2011-03-04 17:58:54 UTC
Permalink
Post by red floyd
[redacted]
Post by crea
True, I forgot the optimization issue.... I use VC6++. I need to do
the same without optimization.
VC6 is horrendously out of date, and predates even the 1998 standard
(much less
the 2003 update).
Get a *REAL* compiler. GCC is available for Windows, and VS2010
Express is
is available for free.
hmmm, GCC with wxwidgets might do the job... must check
RaZiel
2011-03-05 01:24:12 UTC
Permalink
Post by crea
Post by red floyd
[redacted]
Post by crea
True, I forgot the optimization issue.... I use VC6++. I need to do
the same without optimization.
VC6 is horrendously out of date, and predates even the 1998 standard
(much less
the 2003 update).
Get a *REAL* compiler. GCC is available for Windows, and VS2010
Express is
is available for free.
hmmm, GCC with wxwidgets might do the job... must check
If you'd go for wxWidgets and looking for a new C++ IDE for Windows, I'd
recommend CodeLite. It has a single installer with both GCC(MinGW) and
wxWidgets included. It feels natural even if you have used VS for a long
time. You can most likely still go for MFC using CodeLite by the way.

- RaZ
crea
2011-03-05 02:28:54 UTC
Permalink
Post by RaZiel
If you'd go for wxWidgets and looking for a new C++ IDE for Windows,
I'd recommend CodeLite. It has a single installer with both
GCC(MinGW) and wxWidgets included. It feels natural even if you have
used VS for a long time. You can most likely still go for MFC using
CodeLite by the way.
Ok, I actually just installed that one...CodeLite because it was so easy.
Just to test. But I am not able to get windows project showing a windows. I
always just get a black dos window. Why is this?

I go to new project/GUI/.. and tried all wxWidgets project. But when I
compile them I just get a dos window not normal window. Is something still
missing from my computer?
crea
2011-03-05 02:35:37 UTC
Permalink
Post by crea
Post by RaZiel
If you'd go for wxWidgets and looking for a new C++ IDE for Windows,
I'd recommend CodeLite. It has a single installer with both
GCC(MinGW) and wxWidgets included. It feels natural even if you have
used VS for a long time. You can most likely still go for MFC using
CodeLite by the way.
Ok, I actually just installed that one...CodeLite because it was so
easy. Just to test. But I am not able to get windows project showing
a windows. I always just get a black dos window. Why is this?
I go to new project/GUI/.. and tried all wxWidgets project. But when I
compile them I just get a dos window not normal window. Is something
still missing from my computer?
Well its a nice secondary IDE at least... just hoping to get first windows
program compiled... only DOS window appearing...
crea
2011-03-05 03:03:56 UTC
Permalink
Post by crea
Well its a nice secondary IDE at least... just hoping to get first
windows program compiled... only DOS window appearing...
Strange, I try to follow the "
Plugins

--------------------------------------------------------------------------------

a.. Creating a wxWidgets GUI App
"

instructions, but I dont get windows.
RaZiel
2011-03-05 15:50:40 UTC
Permalink
Post by crea
Post by RaZiel
If you'd go for wxWidgets and looking for a new C++ IDE for Windows,
I'd recommend CodeLite. It has a single installer with both
GCC(MinGW) and wxWidgets included. It feels natural even if you have
used VS for a long time. You can most likely still go for MFC using
CodeLite by the way.
Ok, I actually just installed that one...CodeLite because it was so easy.
Just to test. But I am not able to get windows project showing a windows. I
always just get a black dos window. Why is this?
I go to new project/GUI/.. and tried all wxWidgets project. But when I
compile them I just get a dos window not normal window. Is something still
missing from my computer?
This is really off-topic, but since we write "GCC" in here, it should be
OK :P

Cool. Yeah it's intuitive and easy to use straight away. I've
encountered the same problem, it may be that during building there are
actually problems, even if the build reports success at the end. Take a
look into the build window (left-most icon in the bottom).

The problem I had was:
g++: 'D:\Program: Invalid argument
g++: Files\wxWidgets-2.8.10'.: No such file or directory
Problems with whitespace in the path.

Aside from CodeLite hickups, I'm really impressed by wxWidgets and the
wxFormBuilder. Good luck!

- RaZ
crea
2011-03-05 17:44:06 UTC
Permalink
Post by RaZiel
Post by crea
Post by RaZiel
If you'd go for wxWidgets and looking for a new C++ IDE for Windows,
I'd recommend CodeLite. It has a single installer with both
GCC(MinGW) and wxWidgets included. It feels natural even if you have
used VS for a long time. You can most likely still go for MFC using
CodeLite by the way.
Ok, I actually just installed that one...CodeLite because it was so
easy. Just to test. But I am not able to get windows project showing
a windows. I always just get a black dos window. Why is this?
I go to new project/GUI/.. and tried all wxWidgets project. But when
I compile them I just get a dos window not normal window. Is
something still missing from my computer?
This is really off-topic, but since we write "GCC" in here, it should
be OK :P
Cool. Yeah it's intuitive and easy to use straight away. I've
encountered the same problem, it may be that during building there are
actually problems, even if the build reports success at the end. Take
a look into the build window (left-most icon in the bottom).
g++: 'D:\Program: Invalid argument
g++: Files\wxWidgets-2.8.10'.: No such file or directory
Problems with whitespace in the path.
Aside from CodeLite hickups, I'm really impressed by wxWidgets and the
wxFormBuilder. Good luck!
yes, if I press the "Build active project", I get sometimes: "error:
wx/image.h: no such file or directory"

But the funny thing is that if I right click on my project name on Workspace
and select "rebuild all" it says that build is successfull.
crea
2011-03-05 17:46:50 UTC
Permalink
Post by RaZiel
g++: 'D:\Program: Invalid argument
g++: Files\wxWidgets-2.8.10'.: No such file or directory
Problems with whitespace in the path.
yes. Do I possibly have to add some paths to "Environment Variables"? I had
cygwin before this, and this had to be done for it.
Juha Nieminen
2011-03-06 07:55:45 UTC
Permalink
Post by red floyd
[redacted]
Post by crea
True, I forgot the optimization issue.... I use VC6++. I need to do the same
without optimization.
VC6 is horrendously out of date, and predates even the 1998 standard
(much less
the 2003 update).
Not a month goes by without someone saying here that they use VC++ 6.
What is so special about that compiler in particular that it seems to be
so universal? I don't get it.
Dombo
2011-03-06 08:50:04 UTC
Permalink
Post by Juha Nieminen
Post by red floyd
[redacted]
Post by crea
True, I forgot the optimization issue.... I use VC6++. I need to do the same
without optimization.
VC6 is horrendously out of date, and predates even the 1998 standard
(much less
the 2003 update).
Not a month goes by without someone saying here that they use VC++ 6.
What is so special about that compiler in particular that it seems to be
so universal? I don't get it.
It was quite popular in its heyday, and the step to the next version of
Visual Studio was a big one. One of my clients spend over a manyear to
port their code (about 2 million lines) from VC6 to VS2005.
Jorgen Grahn
2011-03-06 11:39:24 UTC
Permalink
Post by Dombo
Post by Juha Nieminen
Post by red floyd
[redacted]
Post by crea
True, I forgot the optimization issue.... I use VC6++. I need to do the same
without optimization.
VC6 is horrendously out of date, and predates even the 1998 standard
(much less
the 2003 update).
Not a month goes by without someone saying here that they use VC++ 6.
What is so special about that compiler in particular that it seems to be
so universal? I don't get it.
It was quite popular in its heyday, and the step to the next version of
Visual Studio was a big one.
Yeah. As I recall it (as a not very interested observer) Microsoft did
VC6. And then they focused on Java, then on .NET and C# and that
bastard C++ for .NET for many years. When they started releasing good,
conforming C++ compilers, it came as a complete surprise to me.

/Jorgen
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
Dombo
2011-03-06 17:56:11 UTC
Permalink
Post by Jorgen Grahn
Post by Dombo
Post by Juha Nieminen
Post by red floyd
[redacted]
Post by crea
True, I forgot the optimization issue.... I use VC6++. I need to do the same
without optimization.
VC6 is horrendously out of date, and predates even the 1998 standard
(much less
the 2003 update).
Not a month goes by without someone saying here that they use VC++ 6.
What is so special about that compiler in particular that it seems to be
so universal? I don't get it.
It was quite popular in its heyday, and the step to the next version of
Visual Studio was a big one.
Yeah. As I recall it (as a not very interested observer) Microsoft did
VC6. And then they focused on Java, then on .NET and C# and that
bastard C++ for .NET for many years. When they started releasing good,
conforming C++ compilers, it came as a complete surprise to me.
...and a pleasant one for a change...
Goran
2011-03-04 09:22:03 UTC
Permalink
Post by crea
How come STL library class is slower than normal C-code? I read from
somewhere that STL classes (vectors) are optmized for performance, so best
to use them. But I did a test and bitset failed.
I made a C-code and then the same with bitset class. C-code did the job in 2
seconds but bitset in 14 seconds. Quite a difference.
Really true that bitset -class is slow? I was thinking of using it , but I
need it to be very fast. If its this slow I cannot use it...
int n = 10001;
  for(int i=0; i<1000000000;i++)
 {
 n |= i; // bit-or operation
 }
bitset<32> bi;
bitset<32> bi2;
 for(int i=0; i<1000000000;i++)
 {
  bi |= bi2;
 }
I think that you speed-tested unoptimized code. Don't, that's
meaningless.

On VC 2008 over here, optimizer removes the "int" loop completely. It
also removes bi |= bi2 completely (but, strangely, not the bitset
loop). If I add a side-effect, effectively tricking the compiler to
generate "int" loop, it runs about twice as slow as "bitset" loop (who
is effectively empty, but present).

Here's my code:

static const unsigned int giga = 1024*1024*1024;
DWORD dw = GetTickCount();
int n = 10001;
for(int i=0; i<giga;i++)
n |= i; // bit-or operation
cout << GetTickCount()-dw << endl;

// Size-effect necessary to trick this particular compiler
// to emit code for the loop above. Without it, loop iz optimized
out.
cout << n << endl;

dw = GetTickCount();
bitset<32> bi;
bitset<32> bi2;
for(int i=0; i<giga;i++)
bi |= bi2;

cout << GetTickCount()-dw << endl;


And here's what relevant parts compile to on my compiler (compiled
with /Ox):

for(int i=0; i<giga;i++)
00F41035 xor eax,eax
n |= i; // bit-or operation
00F41037 or esi,eax // n is in esi, i in eax
00F41039 inc eax
00F4103A cmp eax,40000000h // giga here
00F4103F jb wmain+37h (0F41037h) // loop end condition

for(int i=0; i<giga;i++)
00F41082 mov ecx,40000000h // i is ecx, and strangely, counts
backwards. Ask MS why ;-)
00F41087 sub ecx,1 // count backwards
00F4108A jne wmain+87h (0F41087h) // loop end condition
bi |= bi2; // optimized out, no code for this - at all

Goran.
Loading...