Re: c translations

 BBS: Inland Empire Archive
Date: 01-11-93 (03:41)             Number: 158
From: CORNEL HUTH                  Refer#: NONE
  To: G. ADAM STANISLAV             Recvd: NO  
Subj: Re: c translations             Conf: (3) Dr_Debug

> came from Fortran). You'll see that everything that > you do in C can be done much more cleanly in BASIC. GA> How do you do pointers to functions in BASIC? You want to do what? Re-read my quoted sentence...can be done much more cleanly in BASIC. The idea is that you don't want to do this. 99.9% of the time it isn't necessary to do this, and it doing so is certainly _not_structured_programming_ at all. But, since I've got a feeling you are asking only because you think it can't be done, I'll show you one way that it can: 0. Requires using assembly to build a control module. 10 lines of code. 1. Declare any BASIC SUB/FUNCTION to be called EXTRN in the .asm. 1a. Create table of far pointers of BASIC routines that may be called. (LINK, as it always does, resolves the far pointers at link time.) 2. Have BASIC call the asm control module with a SUB/FUNCTION ID (say, a handle, or simply an index into the table) 2a. Have the asm control module make the call. That's all there is to it. But the use of function pointers does not adhere to structured-programming practices. Why do you think Windows has so many UAEs and GPFs? That's right. Pointers to functions. chh --- Freedom 7 * Origin: [Fortieth Floor/2400@1(210)684-8065,1700-0900cst] (1:387/800.8)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET