GetTime

Why does TP, having set variables h, m, s, hs, as Integer and using these with the command GetTime, that the mentioned varialbes are Type Mismatches (Error: Type Mismatch)
Digit wise, the numbers should work simply because I also tried setting the variable type to LongInt.

Upon looking up the difference between Interger and Word as variable type in the help file, TP says that Integer is 'signed 16-bit' wheras wor is 'unsigned 16-not'
What is the difference. Why cant I use Integer?

Comments

  • : Why does TP, having set variables h, m, s, hs, as Integer and using these with the command GetTime, that the mentioned varialbes are Type Mismatches (Error: Type Mismatch)
    : Digit wise, the numbers should work simply because I also tried setting the variable type to LongInt.
    :
    : Upon looking up the difference between Interger and Word as variable type in the help file, TP says that Integer is 'signed 16-bit' wheras wor is 'unsigned 16-not'
    : What is the difference. Why cant I use Integer?
    :
    Signed means that the value can have negative numbers, where as unsigned cannot. Since each value is ultimately given as individual bits, the signing matters greatly. For example: a word can hold a value up to 65535, where as an integer can only go as high as 32767. This is because the integer is treated as a 15-bit unsigned number with 1 bit indicating if it is positive or negative.
    In the case of var parameters, the Pascal language requires the types to be [b]exactly[/b] the same. If for example GetTime() was allowed to take integers and the year would be 40,000; then it would overflow and give a negative value. This is why Pascal is very strict, when it comes to variable parameters.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion