Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2011-04

intptr_t and Linux

6 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

ik

Hello List,

I see that intptr_t type is defined for all supported Unix that are not Linux.
Is there are reason why it was never declared for Linux ?

stdint.h is define it like so:
/* Types for `void *' pointers. */
#if __WORDSIZE == 64
# ifndef __intptr_t_defined
typedef long int intptr_t;
# define __intptr_t_defined
# endif
typedef unsigned long int uintptr_t;
#else
# ifndef __intptr_t_defined
typedef int intptr_t;
# define __intptr_t_defined
# endif
typedef unsigned int uintptr_t;
#endif

Thanks,

Ido

LINESIP - Opening the source for communication
http://www.linesip.com
http://www.linesip.co.il

Reply by email

Marco van de Voort
to ik

In our previous episode, ik said:

I see that intptr_t type is defined for all supported Unix that are not Linux.

I guess this went to the wrong list. I can't find any intptr_t in e.g. the FreeBSD rtl.

Reply by email

ik
to Marco van de Voort
Marco van de Voort wrote 8 lines
In our previous episode, ik said: > > I see that intptr_t type is defined for all supported Unix that are not > Linux. I guess this went to the wrong list. I can't find any intptr_t in e.g. the FreeBSD rtl.

Right, my bad.

I searched again and you are right:

 grep -in intptr_t ./* -R | grep -v svn
./netbsd/sysnr.inc:144:  { syscall: "sbrk" ret: "int" args: "intptr_t"  }
./netwlibc/libc.pp:127:   Pintptr_t = ^intptr_t;
./netwlibc/libc.pp:128:   intptr_t = longint;
./netwlibc/libc.pp:130:   Puintptr_t = ^uintptr_t;
./netwlibc/libc.pp:131:   uintptr_t = dword;
./netwlibc/libc.pp:782:function sbrk(incr:intptr_t):pointer;cdecl;external
libc_nlm name 'sbrk';
./solaris/ptypes.inc:129:    uintptr_t = ^cuint;

But why doesn't it included ?
It does exists on stdint.h and I can see that gcc C's preprocessor add it to final result.

Ido

_______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Marco van de Voort
to ik

In our previous episode, ik said:

Show quoted text 9 lines
> > Linux. > > I guess this went to the wrong list. I can't find any intptr_t in e.g. the > FreeBSD rtl. Right, my bad. grep -in intptr_t ./* -R | grep -v svn ./netbsd/sysnr.inc:144: { syscall: "sbrk" ret: "int" args: "intptr_t" }

(hasn't been updated in 8 years, that is dead code)

netware and solaris remaining.

But why doesn't it included ? It does exists on stdint.h and I can see that gcc C's preprocessor add it to final result.

We add identifiers on a need-based basis, we don't vacuum the headers to find as many identifiers as possible.

And anyway, it is the c equivalent of ptrint which is a FPC system type.

To further compilate it, the upcoming 64-bit Delphi iirc will also call the equivalent intptr.

and ptrint, intptr and (c)intptr_t is a bit too much without very good reasons.

So, what do you need it for, and why can't you use simply ptrint?

Reply by email

ik
to Marco van de Voort
Marco van de Voort wrote 29 lines
In our previous episode, ik said: > > > Linux. > > > > I guess this went to the wrong list. I can't find any intptr_t in e.g. the > > FreeBSD rtl. > > Right, my bad. > > grep -in intptr_t ./* -R | grep -v svn > ./netbsd/sysnr.inc:144: { syscall: "sbrk" ret: "int" args: "intptr_t" } (hasn't been updated in 8 years, that is dead code) netware and solaris remaining. > But why doesn't it included ? > It does exists on stdint.h and I can see that gcc C's preprocessor add it to > final result. We add identifiers on a need-based basis, we don't vacuum the headers to find as many identifiers as possible. And anyway, it is the c equivalent of ptrint which is a FPC system type. To further compilate it, the upcoming 64-bit Delphi iirc will also call the equivalent intptr.
Show quoted text 5 lines
and ptrint, intptr and (c)intptr_t is a bit too much without very good reasons. So, what do you need it for, and why can't you use simply ptrint?

I bind C code, and looked for it.
And I used PtrInt instead but was interested in understanding the reason why it's not there.

_______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Ido

Reply by email

Marco van de Voort
to ik

In our previous episode, ik said:

Show quoted text 9 lines
> and ptrint, intptr and (c)intptr_t is a bit too much without very good > reasons. > > So, what do you need it for, and why can't you use simply ptrint? > I bind C code, and looked for it. And I used PtrInt instead but was interested in understanding the reason why it's not there.

Ok. I justed asked, because all this is pretty much on the basis of conservative pragmatism.

If there are really heavy reasons (e.g. cases where C and Pascal typing differ), that is a new situation.

Reply by email