Solved

Source code to Val procedure

Posted on 2004-04-15
6
607 Views
Last Modified: 2010-05-18
Hi,

According to Delphi 7 help, the Val procedure is in the system unit. I can't find it there. I want to know if it always returns zero when Code is non zero.

My question is, where is the source code for Val?

Regards,

Bill
0
Comment
Question by:wipnav
  • 3
  • 2
6 Comments
 
LVL 11

Expert Comment

by:Jase-Coder
Comment Utility
You dont actually get the source code. The function/procedure prototypes are stored in the units like system. The function/procedure is a object file so you cannot view the source.

Well that is how C works, so, I guess that delphi will do the same.
0
 
LVL 12

Expert Comment

by:Ivanov_G
Comment Utility

   Project / Options / Compiler / Debuggins

   set there "Use Debug DCU" and when you execute your code Step Into the procedure ...
0
 
LVL 12

Expert Comment

by:Ivanov_G
Comment Utility

   Your system unit is in folder C:\Program Files\Borland\Delphi5\lib, unit system.dcu.

   Obviously the code you have in Source/RTL/Sys is not the unit compiled into this DCU. So use Step Into after you turn "Use Debug DCU". I think this should help ...
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 22

Expert Comment

by:Ferruccio Accalai
Comment Utility
The Val source code isn't available because it's built into the compiler

The System.pas header comment say:
             { Predefined constants, types, procedures, }
             { and functions (such as True, Integer, or }
             { Writeln) do not have actual declarations.}
             { Instead they are built into the compiler }
             { and are treated as if they were declared }
             { at the beginning of the System unit.     }
0
 
LVL 22

Accepted Solution

by:
Ferruccio Accalai earned 50 total points
Comment Utility
BTW: -->I want to know if it always returns zero when Code is non zero.

Not exactly. It depends on the type of the returned var.
See:
Delphi syntax:

procedure Val(S: String; var V; var Code: Integer);

if S is '1.2' and V is integer, code will be 1 and V the integer part of S that is 1 in this case....

So not every time that Code is non zero return 0 for V also...

Hope is clear...
0
 
LVL 22

Expert Comment

by:Ferruccio Accalai
Comment Utility
--> if S is '1.2' and V is integer, code will be 1
should be
if S is '1.2' and V is integer, code will be 2
sorry for the typo
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now