Click here to Skip to main content
15,867,756 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: DateTime.Now vs. GetSystemTime Pin
Bernhard Hiller2-Jun-14 21:35
Bernhard Hiller2-Jun-14 21:35 
GeneralRe: DateTime.Now vs. GetSystemTime Pin
Jörgen Andersson2-Jun-14 21:56
professionalJörgen Andersson2-Jun-14 21:56 
GeneralRe: DateTime.Now vs. GetSystemTime Pin
BobJanova2-Jun-14 0:51
BobJanova2-Jun-14 0:51 
GeneralRe: DateTime.Now vs. GetSystemTime Pin
Rob Philpott10-Jun-14 5:20
Rob Philpott10-Jun-14 5:20 
GeneralRe: DateTime.Now vs. GetSystemTime Pin
Eddy Vluggen6-Jun-14 5:11
professionalEddy Vluggen6-Jun-14 5:11 
GeneralSuccessfully writing to a string literal Pin
Indivara18-May-14 23:44
professionalIndivara18-May-14 23:44 
GeneralRe: Successfully writing to a string literal Pin
Freak3019-May-14 1:45
Freak3019-May-14 1:45 
GeneralRe: Successfully writing to a string literal Pin
Indivara19-May-14 5:17
professionalIndivara19-May-14 5:17 
It only works the other way, you can't put a non-const pointer in a const (without casting).

Ignore that, it is clearly incorrect, I'm the one who got it backwards. See below instead.
C
const char * const_ptr;
char * non_const_ptr;

// The following three are OK
const_ptr = non_const_ptr;
const_ptr = "literal";
non_const_ptr = "literal";

// Causes a compiler error
non_const_ptr = const_ptr;


modified 19-May-14 22:35pm.

GeneralRe: Successfully writing to a string literal Pin
newton.saber19-May-14 1:45
newton.saber19-May-14 1:45 
GeneralRe: Successfully writing to a string literal Pin
Indivara19-May-14 5:15
professionalIndivara19-May-14 5:15 
GeneralRe: Successfully writing to a string literal Pin
newton.saber19-May-14 5:34
newton.saber19-May-14 5:34 
GeneralThe Exception to the C# Rules PinPopular
Brady Kelly15-May-14 18:55
Brady Kelly15-May-14 18:55 
GeneralRe: The Exception to the C# Rules Pin
Bernhard Hiller15-May-14 21:54
Bernhard Hiller15-May-14 21:54 
GeneralRe: The Exception to the C# Rules Pin
Shameel16-May-14 0:53
professionalShameel16-May-14 0:53 
GeneralRe: The Exception to the C# Rules Pin
Keith Barrow19-May-14 6:28
professionalKeith Barrow19-May-14 6:28 
GeneralRe: The Exception to the C# Rules Pin
Bernhard Hiller19-May-14 22:46
Bernhard Hiller19-May-14 22:46 
GeneralRe: The Exception to the C# Rules Pin
cpkilekofp19-Jun-14 9:50
cpkilekofp19-Jun-14 9:50 
GeneralVB6 code that emits VB6 code Pin
MrChug7-May-14 16:12
MrChug7-May-14 16:12 
GeneralI can't set title for this post!!! Pin
Meysam Toluie2-May-14 18:45
Meysam Toluie2-May-14 18:45 
GeneralRe: I can't set title for this post!!! <- then what's that? You trying to confuse me? Pin
Eddy Vluggen3-May-14 8:25
professionalEddy Vluggen3-May-14 8:25 
GeneralRe: I can't set title for this post!!! Pin
PIEBALDconsult3-May-14 12:14
mvePIEBALDconsult3-May-14 12:14 
GeneralRe: I can't set title for this post!!! Pin
cpkilekofp19-Jun-14 11:05
cpkilekofp19-Jun-14 11:05 
GeneralSome useful extension methods Pin
Brisingr Aerowing2-May-14 13:41
professionalBrisingr Aerowing2-May-14 13:41 
GeneralRe: Some useful extension methods Pin
PIEBALDconsult2-May-14 14:50
mvePIEBALDconsult2-May-14 14:50 
GeneralRe: Some useful extension methods Pin
robocodeboy13-May-14 21:52
robocodeboy13-May-14 21:52 

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.