Nr1culprit has asked for the wisdom of the Perl Monks concerning the following question:
I have this script that I use when I need to check perl's data type size in whatever machine I sit on (see below).
As you can see, it uses Config to report integers and double.
Does anybody know how to ask about single precision? Hint: it is not singlesize or floatsize.
Thank you,
Nr1culprit
The script:
#!/usr/bin/perl use strict; use warnings; use Config; print 'short ', $Config{shortsize}, "\n"; print 'int ', $Config{intsize}, "\n"; print 'long ', $Config{longsize}, "\n"; print 'longlong ', $Config{longlongsize}, "\n"; print 'doublesize ', $Config{doublesize}, "\n"; print 'byte order ', $Config{byteorder}, "\n"; exit;
Update:I got it to work just fine with pc88mxer suggestion.
Thank you.
Nr1culprit
In case you are interested, my little script now looks like this:
#!/usr/bin/perl use strict; use warnings; use Config; print 'short ', $Config{shortsize}, "\n"; print 'int ', $Config{intsize}, "\n"; print 'long ', $Config{longsize}, "\n"; print 'longlong ', $Config{longlongsize}, "\n"; print 'f via pack ', length(pack("f", 1.1)), "\n"; print 'doublesize ', $Config{doublesize}, "\n"; print 'byte order ', $Config{byteorder}, "\n"; exit;
Previous content restored and update tag added by GrandFather
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: [OT] Perl and data types (use Config;)
by psini (Deacon) on Jul 17, 2008 at 15:53 UTC | |
| |
|
Re: Perl and data types (use Config;)
by pc88mxer (Vicar) on Jul 17, 2008 at 15:25 UTC | |
|
Re: Perl and data types (use Config;)
by Fletch (Bishop) on Jul 17, 2008 at 15:30 UTC | |
|
Re: Perl and data types (use Config;)
by Narveson (Chaplain) on Jul 17, 2008 at 15:29 UTC |