Once more unto the C++, dear friends, once more
-
Dan Neely wrote:
It's retarded.
Agreed. Although, in the 600K to 800K lines of C++ I have produced I do not recall ever using that one time. I would have had to look it up if I saw it..
John
-
Nemanja Trifunovic wrote:
Underscores are a standard-sanctioned way to extend the language
I agree with that. But there was no need for that (_gc keyword) in the first place. The whole thing could have been a lot simpler. The code simply looked ugly.
Nemanja Trifunovic wrote:
There was really no reason to break compatibility with Managed C++ and introduce "C++/CLI".
Managed C++ was ugly so was C++/CLI. So no arguments there.
Rama Krishna Vavilala wrote:
ugly
I find all C-based languages to be ugly (some more than others). It is not about beauty, but usefulness. Managed C++ is useful for some scenarios and that's what matters. I'd rather use beautiful Haskell but it just does not let me get my job done.
-
I know I've used it for something before, although I'm not sure what it was. Toggling a bitflag without knowing it's original value???
The latest nation. Procrastination.
what about swapping 2 values without a temp variable:
char\* start = str; char\* end = str + (strlen(str) - 1); while (start < end) { \*start ^= \*end; \*end ^= \*start; \*start++ ^= \*end--; } return str;
Pete
-
what about swapping 2 values without a temp variable:
char\* start = str; char\* end = str + (strlen(str) - 1); while (start < end) { \*start ^= \*end; \*end ^= \*start; \*start++ ^= \*end--; } return str;
Pete
I remember that you can do this with XORs however for code readability I would never do that in a program.
John
-
I remember that you can do this with XORs however for code readability I would never do that in a program.
John
John M. Drescher wrote:
you can do this with XORs however for code readability I would never do that in a program
Meh, pack it into a well named inline function, such as
swap_in_place()
and the readability problem is solved. -
I am converting a compiler and language runtime written in C++ into C# - that's fun :^)
I have lots of fun doing the reverse. :laugh:
John
-
Dan Neely wrote:
It's retarded.
Agreed. Although, in the 600K to 800K lines of C++ I have produced I do not recall ever using that one time. I would have had to look it up if I saw it..
John
I’m not agreed. It was all over my code for almost three years. XOR is very heavily used in the cryptography.
The narrow specialist in the broad sense of the word is a complete idiot in the narrow sense of the word. Advertise here – minimum three posts per day are guaranteed.
-
I’m not agreed. It was all over my code for almost three years. XOR is very heavily used in the cryptography.
The narrow specialist in the broad sense of the word is a complete idiot in the narrow sense of the word. Advertise here – minimum three posts per day are guaranteed.
Deyan Georgiev wrote:
XOR is very heavily used in the cryptography.
You just reminded me.. I actually may have to dig into this soon to interface with a medical workstation. I will probably just use a standard library however.
John
-
I have not written any C++ code since 2001. Now I'm dragging one of my old dll's out of mothballs to add some new features. Some where in those 8 absent years the garbage collector or my brain declared C++ syntax of no use and deleted it for me. Now I'm staring at my code wondering what all the hieroglyphics are for. Let's see there's this * guy. He's got something to do with pointers. It's attached or next to some of my variables. Then there's ::, <<, >>, wait.... wait, it's coming back to me.... "<<" is super less than. Got it moving on. Then I run into ^. Oh come on! Who thought ^ was a good idea? Linker? what is that? You mean I have to tell this linker of yours where to look for things just so I can compile? There isn't just a magic "make it go button"? This is going to be a long day. Better load up on the caffeine.
Latest toy built for fun: Web Lens Best feature: Full size images when using Google image search.
pelnor wrote:
Then I run into ^. Oh come on! Who thought ^ was a good idea?
That's in C# too. And I've used it. (If you're going to harp on symbols, how about
&
meaning concatenate in VB? Or the difference between \ and /? Of course, just like in C++ and C#, once you know them, you know them.) -
I am converting a compiler and language runtime written in C++ into C# - that's fun :^)
A few weeks ago I moved a chunk of code from C++ to C#. It required very few minor changes, which was so disconcerting that I kept figuring I did something wrong. But it compiled and worked!
-
Several years of VB got in the way. I mostly do c# now so it's not tooooo much culture shock. Just some head scratching.
Latest toy built for fun: Web Lens Best feature: Full size images when using Google image search.
-
pelnor wrote:
Then I run into ^. Oh come on! Who thought ^ was a good idea?
That's in C# too. And I've used it. (If you're going to harp on symbols, how about
&
meaning concatenate in VB? Or the difference between \ and /? Of course, just like in C++ and C#, once you know them, you know them.)Joe Woodbury wrote:
That's in C# too. And I've used it.
The symbol being there is one thing. How it works and what it represents is another. My favorite was always the := in ADA. Wasn't = good enough for them? Some languages can be similar and still miles apart. Or as Homer would say: Le grille? What the hell is that?[^]
-
Joe Woodbury wrote:
That's in C# too. And I've used it.
The symbol being there is one thing. How it works and what it represents is another. My favorite was always the := in ADA. Wasn't = good enough for them? Some languages can be similar and still miles apart. Or as Homer would say: Le grille? What the hell is that?[^]
1970 - Niklaus Wirth creates Pascal, a procedural language. Critics immediately denounce Pascal because it uses "x := x + y" syntax instead of the more familiar C-like "x = x + y". This criticism happens in spite of the fact that C has not yet been invented. :-\ http://james-iry.blogspot.com/2009/05/brief-incomplete-and-mostly-wrong.html[^]
The latest nation. Procrastination.
-
Joe Woodbury wrote:
That's in C# too. And I've used it.
The symbol being there is one thing. How it works and what it represents is another. My favorite was always the := in ADA. Wasn't = good enough for them? Some languages can be similar and still miles apart. Or as Homer would say: Le grille? What the hell is that?[^]
thrakazog wrote:
My favorite was always the := in ADA. Wasn't = good enough for them?
My favorite was always the == in C. Wasn't = good enough for them?
-
Several years of VB got in the way. I mostly do c# now so it's not tooooo much culture shock. Just some head scratching.
Latest toy built for fun: Web Lens Best feature: Full size images when using Google image search.
Same here. It took me a good while to figure out how to include files properly (i.e., how .h and .cpp relate).
Visual Studio is an excellent GUIIDE.
-
John M. Drescher wrote:
you can do this with XORs however for code readability I would never do that in a program
Meh, pack it into a well named inline function, such as
swap_in_place()
and the readability problem is solved.Along with a small comment, describing the "trick". Nobody will ever have a hard time understanding that. If they would, they probably shouldn't be programmers anyway...
-
thrakazog wrote:
My favorite was always the := in ADA. Wasn't = good enough for them?
My favorite was always the == in C. Wasn't = good enough for them?
:laugh: I almost replied with a dry explanation. Then it hit me. Your sarcasm. :-D