Click here to Skip to main content
15,884,816 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: I have no name, I don't exist Pin
Chris Losinger31-May-09 11:51
professionalChris Losinger31-May-09 11:51 
GeneralRe: I have no name, I don't exist Pin
Thomas Weller31-May-09 20:14
Thomas Weller31-May-09 20:14 
GeneralRe: I have no name, I don't exist [modified] Pin
Chris Losinger1-Jun-09 0:58
professionalChris Losinger1-Jun-09 0:58 
GeneralRe: I have no name, I don't exist Pin
zlezj31-May-09 21:23
zlezj31-May-09 21:23 
GeneralRe: I have no name, I don't exist Pin
johannesnestler3-Jun-09 23:27
johannesnestler3-Jun-09 23:27 
GeneralRe: I have no name, I don't exist Pin
Chris Losinger4-Jun-09 0:57
professionalChris Losinger4-Jun-09 0:57 
GeneralRe: I have no name, I don't exist Pin
supercat94-Jun-09 5:36
supercat94-Jun-09 5:36 
GeneralRe: I have no name, I don't exist Pin
Chris Losinger4-Jun-09 5:51
professionalChris Losinger4-Jun-09 5:51 
supercat9 wrote:
I'm not sure what you mean by anonymous variables.


anonymous = "without a name".

supercat9 wrote:
It is quite normal in C to have expressions yield a value which is ignored.


right. but that has nothing to do with the code i posted above. this isn't about return values.

in C++ you can do this:

CPoint(5,15);


that will construct a CPoint object and immediately destruct it because the variable is anonymous, it has no name, and it isn't used anywhere.

you can also do this:

MyFunc(CPoint(5,15));


this will create a CPoint and pass it to MyFunc.

the latter case us useful - and it's very common to do this when you need to re-package some data that you already into the types that the function expects.

but the former case is much less useful. if the c'tor and d'tor have side-effects, you could possibly use that to take advantage of those side-effects. but it's very non-intuitive. you would be better off moving those side effects to a function that you could call explicitly.


GeneralRe: I have no name, I don't exist Pin
supercat94-Jun-09 8:33
supercat94-Jun-09 8:33 
GeneralRe: I have no name, I don't exist Pin
Chris Losinger4-Jun-09 8:43
professionalChris Losinger4-Jun-09 8:43 
GeneralRe: I have no name, I don't exist Pin
Jörgen Sigvardsson12-Jun-09 6:47
Jörgen Sigvardsson12-Jun-09 6:47 
GeneralQuantity FTW! Pin
Brady Kelly28-May-09 22:15
Brady Kelly28-May-09 22:15 
GeneralRe: Quantity FTW! Pin
Tristan Rhodes28-May-09 23:32
Tristan Rhodes28-May-09 23:32 
GeneralRe: Quantity FTW! Pin
Ian Shlasko29-May-09 10:16
Ian Shlasko29-May-09 10:16 
GeneralRe: Quantity FTW! Pin
Jörgen Sigvardsson12-Jun-09 6:50
Jörgen Sigvardsson12-Jun-09 6:50 
GeneralRe: Quantity FTW! Pin
Brady Kelly12-Jun-09 6:53
Brady Kelly12-Jun-09 6:53 
GeneralRe: Quantity FTW! Pin
Jörgen Sigvardsson12-Jun-09 6:55
Jörgen Sigvardsson12-Jun-09 6:55 
GeneralQuantity, not quality PinPopular
ClementsDan28-May-09 14:25
ClementsDan28-May-09 14:25 
GeneralRe: Quantity, not quality PinPopular
Robert Surtees28-May-09 17:07
Robert Surtees28-May-09 17:07 
GeneralRe: Quantity, not quality Pin
OriginalGriff28-May-09 21:22
mveOriginalGriff28-May-09 21:22 
GeneralRe: Quantity, not quality Pin
CARPETBURNER28-May-09 22:24
CARPETBURNER28-May-09 22:24 
GeneralRe: Quantity, not quality Pin
Jeroen De Dauw28-May-09 22:39
Jeroen De Dauw28-May-09 22:39 
GeneralRe: Quantity, not quality Pin
Tristan Rhodes28-May-09 23:28
Tristan Rhodes28-May-09 23:28 
GeneralRe: Quantity, not quality Pin
PIEBALDconsult31-May-09 16:07
mvePIEBALDconsult31-May-09 16:07 
GeneralRe: Quantity, not quality Pin
Vasudevan Deepak Kumar1-Jun-09 0:34
Vasudevan Deepak Kumar1-Jun-09 0:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.