Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6658073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:50:56+00:00 2026-05-26T01:50:56+00:00

Saw an interesting piece of code recently, and my mind made a snap judgement

  • 0

Saw an interesting piece of code recently, and my mind made a snap judgement that it’d be like something I’d see on TDWTF.

However, before I start changing code I didn’t write in case there is a reason for it, I figured I’d ask here.

public function SomeFunction() As SomeType
    Dim someResult As New SomeType

    // Some code here, where some result can't become nothing.

    try
         return someResult
    catch ex As Exception
         // Some logging code

         return Nothing
    end try
end function

My first impression is that it would be impossible for a simple return with no other operations on the same line to throw an exception, and that this code is unnecessary.

However no compiler warning about unreachable code, so it did have me wondering if it’s at all possible.

Is it? If so, what would be a case it could happen?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:50:56+00:00Added an answer on May 26, 2026 at 1:50 am

    No I don’t think it’s possible. The compiler simply doesn’t know that this statement cannot fail, so it cannot issue a warning.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently saw something interesting in some c++ code: try { //doStuff } catch
I was reading some c++ code, and i saw something interesting. The code was
I was looking at a website and saw something interesting: a DOM element that
I registered account into oracle.com web site and I saw something very interesting: See
Reviewing a changes of old piece of code, I saw a pretty interesting change.
I just saw something very interesting in vk.com Basically in profile page the right
I saw some html that displays the results of a PHP code just by
I ran across some very interesting code that makes me wonder about what bool
I saw this recently, thought it was interesting. But I don't really understand what
Hi I saw that as an interview question and thought it was an interesting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.