Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. One of my own....

One of my own....

Scheduled Pinned Locked Moved The Weird and The Wonderful
10 Posts 8 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Duncan Edwards Jones
    wrote on last edited by
    #1

    Protected Overridable Function getActivityMarketValue(ByVal act As IActivityRecord, ByVal brokerRecord As IST4Record) As Double
    Call getTradeMarketValue(act, brokerRecord)
    End Function

    I stepped through this about 3 times before I worked out why the activity market value kept being set to zero... :doh:

    P Kornfeld Eliyahu PeterK N M 4 Replies Last reply
    0
    • D Duncan Edwards Jones

      Protected Overridable Function getActivityMarketValue(ByVal act As IActivityRecord, ByVal brokerRecord As IST4Record) As Double
      Call getTradeMarketValue(act, brokerRecord)
      End Function

      I stepped through this about 3 times before I worked out why the activity market value kept being set to zero... :doh:

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #2

      ... Aaaand the reason is... ? :confused:

      D 1 Reply Last reply
      0
      • P PIEBALDconsult

        ... Aaaand the reason is... ? :confused:

        D Offline
        D Offline
        Duncan Edwards Jones
        wrote on last edited by
        #3

        I was calling the function - not returning it...so even though the right market value was calculated, it never left that function.

        S 1 Reply Last reply
        0
        • D Duncan Edwards Jones

          I was calling the function - not returning it...so even though the right market value was calculated, it never left that function.

          S Offline
          S Offline
          Stefan Kusters
          wrote on last edited by
          #4

          Brilliant VB language definition... :omg: A function returns a default value if no return value is specified explicitly... :doh:

          R 1 Reply Last reply
          0
          • S Stefan Kusters

            Brilliant VB language definition... :omg: A function returns a default value if no return value is specified explicitly... :doh:

            R Offline
            R Offline
            RugbyLeague
            wrote on last edited by
            #5

            It's not just VB which does that

            1 Reply Last reply
            0
            • D Duncan Edwards Jones

              Protected Overridable Function getActivityMarketValue(ByVal act As IActivityRecord, ByVal brokerRecord As IST4Record) As Double
              Call getTradeMarketValue(act, brokerRecord)
              End Function

              I stepped through this about 3 times before I worked out why the activity market value kept being set to zero... :doh:

              Kornfeld Eliyahu PeterK Offline
              Kornfeld Eliyahu PeterK Offline
              Kornfeld Eliyahu Peter
              wrote on last edited by
              #6

              The beauty of VB... :-D

              Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

              "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

              1 Reply Last reply
              0
              • D Duncan Edwards Jones

                Protected Overridable Function getActivityMarketValue(ByVal act As IActivityRecord, ByVal brokerRecord As IST4Record) As Double
                Call getTradeMarketValue(act, brokerRecord)
                End Function

                I stepped through this about 3 times before I worked out why the activity market value kept being set to zero... :doh:

                N Offline
                N Offline
                Nicholas Marty
                wrote on last edited by
                #7

                Shouldn't that create a compiler error or at least warning as your function doesn't explicitly return a value?

                Richard DeemingR 1 Reply Last reply
                0
                • D Duncan Edwards Jones

                  Protected Overridable Function getActivityMarketValue(ByVal act As IActivityRecord, ByVal brokerRecord As IST4Record) As Double
                  Call getTradeMarketValue(act, brokerRecord)
                  End Function

                  I stepped through this about 3 times before I worked out why the activity market value kept being set to zero... :doh:

                  M Offline
                  M Offline
                  Marc Clifton
                  wrote on last edited by
                  #8

                  At least in C# it tells you when you're supposed to return a value. I don't suppose this would have been caught by turning on VB's "strict" option? Of course, the last time I did that to some VB code I inherited, I got thousands of errors. :doh: Marc

                  Imperative to Functional Programming Succinctly Contributors Wanted for Higher Order Programming Project!

                  D 1 Reply Last reply
                  0
                  • N Nicholas Marty

                    Shouldn't that create a compiler error or at least warning as your function doesn't explicitly return a value?

                    Richard DeemingR Offline
                    Richard DeemingR Offline
                    Richard Deeming
                    wrote on last edited by
                    #9

                    It gives you a warning:

                    BC42353 Function 'getActivityMarketValue' doesn't return a value on all code paths. Are you missing a 'Return' statement?


                    "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                    "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                    1 Reply Last reply
                    0
                    • M Marc Clifton

                      At least in C# it tells you when you're supposed to return a value. I don't suppose this would have been caught by turning on VB's "strict" option? Of course, the last time I did that to some VB code I inherited, I got thousands of errors. :doh: Marc

                      Imperative to Functional Programming Succinctly Contributors Wanted for Higher Order Programming Project!

                      D Offline
                      D Offline
                      Duncan Edwards Jones
                      wrote on last edited by
                      #10

                      I think "Option Strict" would pick that up alright. But I think the same rule applies to coding as parenting - if the child is already 5 years old it is way too late to start getting strict ;-)

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups