Solved

Source code to Val procedure

Posted on 2004-04-15
6
618 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 11

Expert Comment

by:Jase-Coder
ID: 10833418
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
ID: 10833592

   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
ID: 10833619

   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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 10833735
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
ID: 10833902
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
ID: 10833918
--> 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

707 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