0

I am just curious to know.

I already know the operator precedence in Visual Basic.NET and it is easy to find a reference about it anyway.

What I do NOT know is the precedence of built-in functions related to the operators and maybe any priority difference between them, if there is any precedence for them whatsoever.

I mean are built-in functions executed with priority higher than parentheses and everything, are they in a certain priority point or do we consider them being at the bottom and just execute before being used by an operator?

Does the priority of execution varies according to the function? Here are some built in functions I am interested in.

Abs() 
Cos() 
Exp()
Pow()
Sqrt()
Max()
CInt()
CLng()
CStr()
CDbl()

1 Answer 1

1

There is no "precedence". Any functions, inline or not, are executed exactly when you would expect. Any expression used as an argument to a function must be evaluated before the function can be executed and the function must be executed before its result can be used. It's that simple.

Think about it. You're implying that it might be the case that this code:

x = a + CInt(b)

could possibly evaluated by a being added to b before the CInt call is executed. How could that possibly make sense?

3
  • Yes that is what I thought. I just wanted to be 100% sure about it.Answer accepted. Thank you very much mate.
    – George Eco
    Nov 10, 2015 at 2:05
  • Cool. Just note that the up and down arrows are for people other than the OP. To accept an answer you are supposed to click the check mark. Nov 10, 2015 at 2:10
  • I know, It has a time limiter I had to let time pass to be able to accept it. At last! Now I can.
    – George Eco
    Nov 10, 2015 at 2:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.