Click here to Skip to main content
15,867,860 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
AnswerRe: C Sharps - how are you getting on with nullable reference types? Pin
Daniel Pfeffer15-Dec-20 23:40
professionalDaniel Pfeffer15-Dec-20 23:40 
GeneralRe: C Sharps - how are you getting on with nullable reference types? Pin
Rob Philpott15-Dec-20 23:42
Rob Philpott15-Dec-20 23:42 
GeneralRe: C Sharps - how are you getting on with nullable reference types? Pin
Nelek16-Dec-20 1:29
protectorNelek16-Dec-20 1:29 
GeneralRe: C Sharps - how are you getting on with nullable reference types? Pin
honey the codewitch16-Dec-20 3:32
mvahoney the codewitch16-Dec-20 3:32 
GeneralRe: C Sharps - how are you getting on with nullable reference types? Pin
Greg Utas16-Dec-20 2:17
professionalGreg Utas16-Dec-20 2:17 
GeneralRe: C Sharps - how are you getting on with nullable reference types? Pin
Daniel Pfeffer16-Dec-20 4:43
professionalDaniel Pfeffer16-Dec-20 4:43 
GeneralRe: C Sharps - how are you getting on with nullable reference types? Pin
Greg Utas16-Dec-20 5:12
professionalGreg Utas16-Dec-20 5:12 
GeneralRe: C Sharps - how are you getting on with nullable reference types? Pin
Mladen Janković16-Dec-20 5:44
Mladen Janković16-Dec-20 5:44 
Greg Utas wrote:
It's not undefined behavior yet.


It is:

A reference shall be initialized to refer to a valid object or function. [Note: in particular, a null reference cannot exist in a well-defined program, because the only way to create such a reference would be to bind it to the “object” obtained by dereferencing a null pointer, which causes undefined behavior. As described in 9.6, a reference cannot be bound directly to a bit-field.]

Just because it works today on your set of compilers, does not mean it will continue to work tomorrow when for instance standard introduce contracts or compiler implementer decide to make optimizations based on the assumption. Compilers are already taking UB as license to do optimizations, giving language users all kind of WTF moments.

Most famous case of a similar nature is probably this one in Linux: Fun with NULL pointers, part 1 [LWN.net]

The point is you cannot reason about UB.
GeneralRe: C Sharps - how are you getting on with nullable reference types? Pin
Greg Utas16-Dec-20 5:49
professionalGreg Utas16-Dec-20 5:49 
GeneralRe: C Sharps - how are you getting on with nullable reference types? Pin
Mladen Janković16-Dec-20 5:58
Mladen Janković16-Dec-20 5:58 
GeneralRe: C Sharps - how are you getting on with nullable reference types? Pin
Greg Utas16-Dec-20 6:04
professionalGreg Utas16-Dec-20 6:04 
GeneralRe: C Sharps - how are you getting on with nullable reference types? Pin
Daniel Pfeffer16-Dec-20 5:54
professionalDaniel Pfeffer16-Dec-20 5:54 
GeneralRe: C Sharps - how are you getting on with nullable reference types? Pin
Mladen Janković16-Dec-20 6:00
Mladen Janković16-Dec-20 6:00 
GeneralRe: C Sharps - how are you getting on with nullable reference types? Pin
Greg Utas16-Dec-20 6:08
professionalGreg Utas16-Dec-20 6:08 
GeneralRe: C Sharps - how are you getting on with nullable reference types? Pin
Gerry Schmitz16-Dec-20 5:37
mveGerry Schmitz16-Dec-20 5:37 
AnswerRe: C Sharps - how are you getting on with nullable reference types? Pin
PIEBALDconsult16-Dec-20 3:00
mvePIEBALDconsult16-Dec-20 3:00 
GeneralRe: C Sharps - how are you getting on with nullable reference types? Pin
BabyYoda16-Dec-20 3:20
BabyYoda16-Dec-20 3:20 
AnswerRe: C Sharps - how are you getting on with nullable reference types? Pin
Marc Clifton16-Dec-20 3:35
mvaMarc Clifton16-Dec-20 3:35 
GeneralRe: C Sharps - how are you getting on with nullable reference types? Pin
Jörgen Andersson16-Dec-20 4:30
professionalJörgen Andersson16-Dec-20 4:30 
GeneralRe: C Sharps - how are you getting on with nullable reference types? Pin
lmoelleb16-Dec-20 7:07
lmoelleb16-Dec-20 7:07 
AnswerRe: C Sharps - how are you getting on with nullable reference types? Pin
Jörgen Andersson16-Dec-20 4:27
professionalJörgen Andersson16-Dec-20 4:27 
AnswerRe: C Sharps - how are you getting on with nullable reference types? Pin
Gerry Schmitz16-Dec-20 5:32
mveGerry Schmitz16-Dec-20 5:32 
GeneralRe: C Sharps - how are you getting on with nullable reference types? Pin
lmoelleb16-Dec-20 7:24
lmoelleb16-Dec-20 7:24 
AnswerRe: C Sharps - how are you getting on with nullable reference types? Pin
harold aptroot16-Dec-20 20:24
harold aptroot16-Dec-20 20:24 
AnswerRe: C Sharps - how are you getting on with nullable reference types? Pin
Lorenzo Bertolino16-Dec-20 20:36
professionalLorenzo Bertolino16-Dec-20 20:36 

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.