More On ByRef vs ByVal

In my previous entry I discussed VBScript’s various syntaxes for passing values by reference.  However it occurs to me that there may be some confusion about what exactly “byref” and “byval” mean in JScript and VBScript.  This is frequently a source of confusion, as VBScript has byref behaviour not supported by JScript. The confusion arises…

7

What do you mean "cannot use parentheses?"

Every now and then someone will ask me what the VBScript error message “Cannot use parentheses when calling a Sub” means. I always smile when I hear that question. I tell people that the error means that you CANNOT use PARENTHESES when CALLING a SUB — which word didn’t you understand? Of course, there is…

56

Why does JScript have rounding errors?

Try this in JScript: window.alert(9.2 * 100.0); You might expect to get 920, but in fact you get 919.9999999999999.  What the heck is going on here? Boy, have I ever heard this question a lot. Well, let me answer that question with another question.  Suppose you did a simple division, say window.alert(1.0 / 3.0); Would…

7

What’s Up With Hungarian Notation?

I mentioned Hungarian Notation in my last post — a topic of ongoing religious controversy amongst COM developers. Some people swear by it, some people swear about it. The anti-Hungarian argument usually goes something like this: “What is the point of having these ugly, hard-to-read prefixes in my code which tell me the type? I…

22

Eric’s Complete Guide To BSTR Semantics

If you’ve ever done any C++ or C programming that used COM objects, you’ll certainly have seen code like this: STDMETHODIMP CFo:Bar(BSTR bstrABC) { // … What is this BSTR thing, and how does it differ from WCHAR* ? Low-level languages like C or C++ allow you great freedom in deciding which patterns of bits…

35

Fabulous Adventures!

Hi there. Welcome to my blog. This introduction was last updated in 2011. Who is this guy? I’m Eric Lippert, a developer in the Visual Studio team at Microsoft. I have been in the developer division full time since 1996 and was an intern for a couple of years before that. In my years at…

1