Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Free Pascal
»
General
(Moderators:
FPK
,
Tomas Hajny
) »
equivalent to C/C++ "offsetof" ?
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Lazarus 4.6 may erase you...
by
marcov
[
Today
at 12:20:12 pm]
Help needed on how to do ...
by
cdbc
[
Today
at 12:15:15 pm]
val return code
by
avk
[
Today
at 11:42:21 am]
PascalRAL the fastest, mo...
by
Mobius1
[
Today
at 11:24:00 am]
TDateTimePicker - Make th...
by
AlexanderT
[
Today
at 09:57:05 am]
TCollection wiki entry
by
Thaddy
[
Today
at 05:44:53 am]
I have made some progress...
by
onionmixer
[
Today
at 04:17:27 am]
equivalent to C/C++ "offs...
by
creaothceann
[
Today
at 12:50:49 am]
UI app to work with SQLit...
by
LeP
[
Today
at 12:50:04 am]
Elite Arcade
by
Guva
[July 11, 2026, 11:25:29 pm]
Freepascal
by
marcelomaurinmartins@gmai
[July 11, 2026, 11:24:44 pm]
International Pascal Cong...
by
vincococka
[July 11, 2026, 11:18:49 pm]
Printing on HP Smart Tank
by
JerryHudson
[July 11, 2026, 10:22:12 pm]
Why is my program freezin...
by
paweld
[July 11, 2026, 07:19:46 pm]
is there PDS reader/expor...
by
jamie
[July 11, 2026, 07:01:12 pm]
Fpcupdeluxe
by
cdbc
[July 11, 2026, 06:40:29 pm]
weird error message
by
jamie
[July 11, 2026, 06:37:01 pm]
Como compilar uma lib par...
by
marcelomaurinmartins@gmai
[July 11, 2026, 06:24:51 pm]
Desenvolvimento visual pa...
by
marcelomaurinmartins@gmai
[July 11, 2026, 06:19:16 pm]
OpenDocument('Filename') ...
by
J-G
[July 11, 2026, 06:13:03 pm]
TTL Record Count, i.e. a ...
by
1HuntnMan
[July 11, 2026, 06:05:29 pm]
Using callback
by
LemonParty
[July 11, 2026, 05:43:15 pm]
Source Editor Collapsed P...
by
J-G
[July 11, 2026, 11:17:14 am]
Habari STOMP Clients for ...
by
mjustin
[July 11, 2026, 11:15:54 am]
Questions on slight diffe...
by
egsuh
[July 11, 2026, 09:45:30 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: equivalent to C/C++ "offsetof" ? (Read 249 times)
jamie
Hero Member
Posts: 7827
equivalent to C/C++ "offsetof" ?
«
on:
July 11, 2026, 02:32:18 am »
I used to be able to do something like this:
UintPtr(@TSomeRecord(Nil).AmemberField);
I could of use "Integer" as the cast instead, can't remember but, it will give me the offset value of the field.
Jamie
Logged
The only true wisdom is knowing you know nothing
Fibonacci
Hero Member
Posts: 1024
Behold, I bring salvation - FPC Unleashed
Re: equivalent to C/C++ "offsetof" ?
«
Reply #1 on:
July 11, 2026, 02:44:35 am »
Code: Pascal
[Select]
[+]
[-]
writeln
(
UintPtr
(
@
TSomeRecord
(
Nil
^
)
.
AmemberField
)
)
;
// objfpc
writeln
(
OffsetOf
(
TSomeRecord
.
AmemberField
)
)
;
// unleashed
Logged
FPC Unleashed
: async/await, parallel for, match, tuples, string interpolation, inline vars, autofree, no-RTTI & tons more.
Star on GitHub
⭐
jamie
Hero Member
Posts: 7827
Re: equivalent to C/C++ "offsetof" ?
«
Reply #2 on:
July 11, 2026, 12:58:11 pm »
Looks interesting. The unleased FPC compiler, that is.
Logged
The only true wisdom is knowing you know nothing
creaothceann
Sr. Member
Posts: 389
Re: equivalent to C/C++ "offsetof" ?
«
Reply #3 on:
Today
at 12:50:49 am »
*unleashed
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Free Pascal
»
General
(Moderators:
FPK
,
Tomas Hajny
) »
equivalent to C/C++ "offsetof" ?
TinyPortal
© 2005-2018