Re: methods and returned values

Peter Ritchie <[email protected]> Fri, 27 Oct 2006 12:26:18 -0400
Newsgroups gmane.comp.windows.devel.dotnet.cx
Message-ID <LISTSERV%[email protected]>
In Microsoft C/C++ there is a keyword to specify that a function does not
return: __declspec(noreturn).  This tells the compiler that a call to that
function will never return as it likely exits the process/application.

Unfortunately there doesn't seem to be an equivalent in .NET languages (I
haven't checked if __declspec(noreturn) works in MC++ or C++/CLI).

Framework methods that do exit the process, like Environment.Exit() or
Environment.FailFast() also result in the same "not all code paths return
a value"--which seems to confirm there is no method of specifying a method
does not return allowing the compiler to detect unreachable code or
avoid "not all code paths return a value".

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com