|
An interesting way to hide intentiously introduced errors from being discovered...
By the way, how does it come that compilation did not fail?
|
|
|
|
|
Oops! It was like this:
if (flag)
{
SomeWork();
}
|
|
|
|
|
Ah, then it's an interesting variant of
if (flag and some more long conditions filling more than the width of the screen);
{
SomeWork();
}
|
|
|
|
|
That's a reason more to use K&R style (or a variation of it)!! 
|
|
|
|
|
That's a lousy attempt at obfuscation.
Here's a real professional at work: IOCCC[^].
(That is a full hardware emulation of a 1980's PC hardware (much more info in the other files in this folder[^].
Some top aspects:
It is 4043 bytes long (half an 8086).
"It manages to implement most of the hardware in a 1980’s era IBM-PC using a few hundred fewer bits than the total number of transistors used to implement the original 8086 CPU."
(edited for spelling)
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
Whoa... [^].
Greetings - Jacek
|
|
|
|
|
In this case the
if (flag) would be colored in green showing that its part of the comment and it wont be read by the compiler. This should be enough of hint why SomeWork() is executed no matter the flag's value
Microsoft ... the only place where VARIANT_TRUE != true
|
|
|
|
|
That's assuming that the coder was using an IDE that supports colourisation. I know many C++ coders who work almost exclusively in Notepad++.
|
|
|
|
|
Nodepad++ supports coloring. I just tested and it changed the color of the if statement to green.
Note: you need to save the file with the proper extension to enable the coloring of the text.
Edit : Even with Borland c++ and djgpp compilers under dos you still have the proper coloring
Microsoft ... the only place where VARIANT_TRUE != true
modified 15-Jan-14 3:59am.
|
|
|
|
|
And what about those hard core devs who swear by (instead of at) vi? My point wasn't that Notepad++ supports or does not support colourisation. It's that you can't rely on colourisation to indicate problems.
|
|
|
|
|
You can if you're not masochist 
|
|
|
|
|
Hey, I like vi. There are parts of it that I wish were available in Visual Studio. dd for instance. Or 10dd to delete 10 lines. Yes, you can do this using other means in an IDE, but they are all more cumbersome.
|
|
|
|
|
I have some exp with vi. I didn't see any particular bonuses which will make me change the compiler, but q! has his advantages
syntax coloring in vi and vim
Microsoft ... the only place where VARIANT_TRUE != true
|
|
|
|
|
That is pretty cool. I didn't know you could do that.
|
|
|
|
|
I just can't get myself to tolerate vi, maybe because my only contact with it was on a old debian distro on my SO class, but the ammount of work needed to edit a simple 2 line key:value file threw me off.
|
|
|
|
|
I started off my professional programming career using vi as my editor. Ah, for the days of :wq.
|
|
|
|
|
that really sounds like pain, but it's painfull to deal with IDE bugs and slowdowns too, so maybe you're right 
|
|
|
|
|
We didn't have IDE's on Unix systems when I started. I'm, what's the word I'm looking for? Oh yes, I'm old.
|
|
|
|
|
Yup, no argument from here.
BTW, IIRC in vi you can write and exit with only three key strokes - [ESC]ZZ - rather than the cumbersome five of [ESC]:wq[ENTER] .
speramus in juniperus
|
|
|
|
|
Well, I'm young and I run away from unix, so there's that 
|
|
|
|
|
A good while ago I worked in a department where we did software development on both MSDos and Unix boxes. On the Dos boxes we used a realy good text editor called MultiEdit. One developer asked if I could get him MultiEdit for Unix - I replied no, but said that I couod get him vi for Dos - he nearly punched me!
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
VsVim[^] might be useful for you. It adds Vim commands to VS.
Getting information off the Internet is like taking a drink from a fire hydrant.
- Mitchell Kapor
|
|
|
|
|
Teach me to comment before reading the whole thread
|
|
|
|
|
Heh. I am not all that used to Vi(m), but this extension seems to be quite powerful.
<voice type="Ebeneezer Scrooge"> Bah. dumb bugs </voice>
|
|
|
|
|
I have a vi plugin for visual studio. It's called vsvim, and as far as I remember I installed it in the extension manager gui.
|
|
|
|