Click here to Skip to main content
15,895,656 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: What will you call this??? Pin
Paul Conrad8-Nov-08 8:02
professionalPaul Conrad8-Nov-08 8:02 
GeneralRe: What will you call this??? Pin
AhsanS9-Nov-08 17:35
AhsanS9-Nov-08 17:35 
GeneralRe: What will you call this??? Pin
Louis Cipher10-Nov-08 15:19
Louis Cipher10-Nov-08 15:19 
GeneralRe: What will you call this??? Pin
Megidolaon22-Feb-09 23:53
Megidolaon22-Feb-09 23:53 
GeneralI wonder!!!! Pin
AhsanS6-Nov-08 0:22
AhsanS6-Nov-08 0:22 
GeneralRe: I wonder!!!! Pin
cyber-drugs6-Nov-08 2:34
cyber-drugs6-Nov-08 2:34 
GeneralRe: I wonder!!!! Pin
PIEBALDconsult6-Nov-08 4:07
mvePIEBALDconsult6-Nov-08 4:07 
GeneralRe: I wonder!!!! [modified] Pin
Thomas Weller6-Nov-08 6:24
Thomas Weller6-Nov-08 6:24 
AhsanS wrote:
namespace abc{

Is this really twice in the source or is it just a copy/paste mistake? If so, this code should not compile.

If not:
using statements can occur in one of two places:
- Above namespace declaration
- Inside namespace declaration, but outside any other element

This combined with the fact that duplicating a using directive is only treated as a warning not as an error, your code will compile - even if it's quite horrible indeed.

AhsanS wrote:
What is benefit of it after all?

- It forces the developer to be explicit about what he's doing - always a good thing.
- Types with identical names can occur in more than one namespace. With using you can distinguish them properly.
(Take for example System.Windows.Forms.Timer vs. System.Threading.Timer...).

Regards
Thomas

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

Programmer - an organism that turns coffee into software.


modified on Thursday, November 6, 2008 12:30 PM

GeneralRe: I wonder!!!! Pin
PIEBALDconsult6-Nov-08 14:38
mvePIEBALDconsult6-Nov-08 14:38 
GeneralRe: I wonder!!!! Pin
Thomas Weller6-Nov-08 18:51
Thomas Weller6-Nov-08 18:51 
GeneralRe: I wonder!!!! Pin
PIEBALDconsult7-Nov-08 3:36
mvePIEBALDconsult7-Nov-08 3:36 
GeneralRe: I wonder!!!! Pin
Thomas Weller7-Nov-08 3:45
Thomas Weller7-Nov-08 3:45 
GeneralRe: I wonder!!!! Pin
AhsanS6-Nov-08 18:23
AhsanS6-Nov-08 18:23 
GeneralRe: I wonder!!!! Pin
Thomas Weller6-Nov-08 18:48
Thomas Weller6-Nov-08 18:48 
GeneralRe: I wonder!!!! Pin
AhsanS7-Nov-08 0:56
AhsanS7-Nov-08 0:56 
GeneralRe: I wonder!!!! Pin
Thomas Weller7-Nov-08 2:33
Thomas Weller7-Nov-08 2:33 
GeneralRe: I wonder!!!! Pin
AhsanS7-Nov-08 8:13
AhsanS7-Nov-08 8:13 
GeneralRe: I wonder!!!! Pin
Thomas Weller7-Nov-08 8:39
Thomas Weller7-Nov-08 8:39 
GeneralRe: I wonder!!!! Pin
Megidolaon23-Feb-09 0:00
Megidolaon23-Feb-09 0:00 
GeneralRe: I wonder!!!! Pin
Paul Conrad6-Nov-08 7:45
professionalPaul Conrad6-Nov-08 7:45 
GeneralRe: I wonder!!!! Pin
PIEBALDconsult6-Nov-08 14:33
mvePIEBALDconsult6-Nov-08 14:33 
GeneralRe: I wonder!!!! Pin
AhsanS6-Nov-08 18:24
AhsanS6-Nov-08 18:24 
GeneralRe: I wonder!!!! Pin
notmasteryet10-Dec-08 7:20
notmasteryet10-Dec-08 7:20 
Generalsomeone who does not trust arithmetic PinPopular
shadayim4-Nov-08 0:44
shadayim4-Nov-08 0:44 
GeneralRe: someone who does not trust arithmetic Pin
negretrucci4-Nov-08 2:17
negretrucci4-Nov-08 2:17 

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.