Forum > Beginners

Inline code does not compile?

(1/2) > >>

Weiss:
I am studying by "Turbo Pascal 6 Complete Reference Guide". The part where it describes using inline code does not compile. Sometimes  the  "inline" identifier is not recognized.  Most of the time Compiler sees "(" where it wants ":". I tried using compiler directives {$mode TP} and {$INLINE+} or {$INLINE ON} but syntax error is still there.

What is the trick here? How do we use inline code in FPC, that is different from what was in TP?

MarkMLl:
SHOW US YOUR CODE!!!!!!!!!!!!

If it's a small program it's OK to put it inline with your message but you will need to mark it with the code tag. Otherwise add it as an attachment. In either case please make sure that it's a complete program, i.e. something that other people can fairly be expected to compile without spending lots of time working out what you're trying to do.

Apart from that, what version of FPC etc. are you using?

Note also that in some cases the FPC compiler will compile something without obeying an inline directive (due to code complexity etc.); you will get a warning if this happens.

MarkMLl

marcov:
The inline command (with bytes to inline assembler) of Turbo Pascal is not supported yet. (though I can vaguely recall Nikolay adding it to trunk).

But even then it is  16-bits dos only, and I'm not sure you want that, so in practice you will need to find other solutions anyway.

Examples would help, and also what your goal is (really dos?  16-bit or 32-bit ?)

Zvoni:

--- Quote from: MarkMLl on July 04, 2022, 10:55:21 am ---Apart from that, what version of FPC etc. are you using?

--- End quote ---
LOL. What did we discuss in that other thread of yours?

440bx:

--- Quote from: Weiss on July 04, 2022, 09:52:48 am ---I am studying by "Turbo Pascal 6 Complete Reference Guide". The part where it describes using inline code does not compile. Sometimes  the  "inline" identifier is not recognized. 

--- End quote ---
The old TP inline thing where the programmer had to hand code the bytes for opcodes and data is really extremely undesirable.

With FPC, you can code that inline stuff in assembler.  I remember that, at least most of the time, programmers were courteous enough to put the equivalent assembly statements next to the hand coded bytes as a comment thus, making the "port" to real assembler fairly straightforward.

My recommendation is: stay as far away from that old inline stuff and, if needed, convert it to assembler.

Navigation

[0] Message Index

[#] Next page

Go to full version