Trying to use math function: sgn... error : sgn is not declared - windows

hmm...
I imported:System.math...
test as integer=sgn(100)
I get the error: sgn is not declared.
Other math functions work.
So Why?
Might Visual Studio not be correctly installed?
Thank Yall!
flabbergasted: Jhonny Q

Missing the character "i"
That particular Math function is named sign.
Thus sgn, being user defined, misses its declaration.

Thanks for you response; Sep Roland.
That alone still gets me a: is not declared.
What works is: Math.Sign. ,or do a: Imports System.Math.
Then sign works also.

Related

DIA SDK how to get parent function of FuncDebugStart / FuncDebugEnd?

The documentation for SymTagFuncDebugStart and SymTagFuncDebugEnd state that calling IDiaSymbol::get_lexicalParent will return a symbol for the enclosing function. I interpret this as I will get an IDiaSymbol whose get_symTag method returns SymTagFunction. However, when I do this it returns me the SymTagCompiland and not the function. So the documentation appears wrong, but worse I'm not sure how to actually tie the SymTagFuncDebugStart and SymTagFuncDebugEnd to the containing SymTagFunction.
Does anyone know? A few dumps suggest that SymTagFuncDebugStart and SymTagFuncDebugEnd always come immediately after the corresponding SymTagFunction when enumerating the symbols via IEnumSymbols. Or put another way, that if IDiaSymbol::get_symIndexId returns n for the function, it will return n+1 and n+2 respectively for the func debug start and func debug end.
But I can't be sure this is always true, and this seems unreliable and hackish.
Does anyone have any suggestions on the correct way to do this?
Could you paste your code here? I guess there is something wrong in your code. Call get_lexicalParent on SymTagFuncDebugStart and SymTagFuncDebugEnd should return the symbol associated the enclosing function (SymTagFunction).
I got this working eventually. The problem is that when you enumerate all the symbols in the global scope using SymTagNull, you will find the FuncDebugStart and FuncDebugEnd symbols. The lexical parent of these symbols is the global scope, because it's the "parent" in the sense that it vended you the pointers to the FuncDebugStart and FuncDebugEnd symbols.
If you get the FuncDebugStart and FuncDebugEnd by calling findChildren on an actual SymTagFunction symbol, however, then its lexical parent will in fact be the original function. So this was an issue of unclear documentation.

No compile time TypeScript errors for enums

This looks strange for me but TypeScript 0.9.5 compiler does not generate any compile time errors when I write something like:
enum A {
a,
b,
c,
}
var x : A = 20;
To compare C# compiler will raise the following error:
Cannot implicitly convert type 'int' to 'System.Security.AccessControl.AccessControlSections'. An explicit conversion exists (are you missing a cast?)
As for me it would be better to specify such cast explicitly:
var x : A = <A>20;
Is it an intentional design and is required in some use case or this was jut missed?
It's intentional. The fact that the C# compiler knows what you meant ("are you missing a cast?") is instructive -- in general, TypeScript errs on the side of flexibility over strictness. Some people want a cast to be required here "to show that you thought about it"; the assumption in this case is that you are always thinking while programming and should not be bothered unless something is more obviously wrong.
This is by design. Numbers can be assigned to enums without a cast and vice versa.

Type Mismatch error on WAIT?

This one is making me a little crazy and I hope someone can help.
I added a wait(45) line to my QTP script and when it runs I get a type mismatch error.
I know this will occur if a function can't be called or I misspell something to be called or etc.
But, this is a simple WAIT statement. Nothing else on the line.
Line: 152
Char: 6
Error: Type mismatch: 'Wait'
Code 800A000D
Any ideas? Did I miss something? How can there be a type mismatch on Wait?
There definitely is no Wait() sub or function in VBScript; as this question indicates, this holds for QTP too.
As to the error: a missing sub/function throws a type mismatch:
>> nosuchsub
>>
Error Number: 13
Error Description: Type mismatch
(If this consoles you, I don't like it neither.)
Actual error is not in Wait function. QTP shows type mismatch error due to compilation error in previous lines. Check all your library files are properly added. Best method to find the root cause of problems like this is to divide your code into smaller functions / procedures and test each function.

Unclassifiable statement when calling a specific function

I want to add a function to my code that will calculate some variable. I created a dummy function
double precision FUNCTION rawSE(x)
double precision x
real ax
rawSE = 0.0d0
return
END
And I call it using
selfE=rawSE(1.0d0)
When I try to compile the code, I get the error in the title. When I replace the rawSE with a value (1.0d0) I don't get an error. When I replace it with another function, I don't get an error. I copied a function that work properly and renamed it. I get the error.
So... what is going on here? This is not a column position issue (at least not a simple one) as they are all start on the same line.
How to resolve this?
The rawSE function was declared in a module and a value was expected instead of a function. Moving the declaration out of the module part solved this.
I asked whether you declared rawSE in the program that uses it, and you replied that you declared it as double precision. Do you mean that you declare the function both in the module and in the program that uses the module? Like this?
module my_stuff
implicit none
contains
double precision FUNCTION rawSE(x)
double precision x
rawSE = 2.0d0 * x
return
end FUNCTION rawSE
end module my_stuff
program test_rawSE
use my_stuff
implicit none
double precision rawSE ! <-- This line
write (*, *) rawSE (2.0d0)
end program test_rawSE
If so, that is the problem. You should declare the function once, so the line "This line" should be removed. It is better to keep the module because that makes the interface explicit to the compiler. Not only does it "know" that that the function return is double precision, it also "knows" that the function has a single double-precision argument. This enables it to check the arguments of calls for consistency with these properties.
P.S. gfortran 4.1 is really old and out of date. More recent versions are much improved. That might be why the error message is cryptic. gfortran 4.7 identifies that two statements conflict with each other:
double precision rawSE
1
rawSE.f90:18.4:
use my_stuff
2
Error: Symbol 'rawse' at (1) conflicts with symbol from module 'my_stuff', use-associated at (2)

<variable>! syntax in Visual Basic 6

I'm working through some legacy code for a client and I think I understand this line but I need vb expert to double-check me.
QS1! = Unit1.XICFMc(1)
My guess is that this saying:
"If QS1 doesn't exist, DIM it and assign it the value in the first position in Unit1.XICFMc"
Am I right? I can't find a definition for QS1 anywhere in the project - which is what lead me to my guess above.
Given the lack of Option Explicit, a variable is implicitly created when first used.
The ! clarifies that QS1 is of type Single.
Isn't a trailing ! mean that the QS1 variable should be typed as Single. This is a holdover from early versions of basic that used postfixes to declare types. v$ was a string, v% was an integer etc. IIRC, you cannot have option explicit on for this to work.

Resources