Req #75491 [Wfx]: need structs, unions
Edit report at https://bugs.php.net/bug.php?id=75491&edit=1
ID: 75491
User updated by: jmichae35 at gmail dot com
Reported by: jmichae35 at gmail dot com
Summary: need structs, unions
Status: Wont fix
Type: Feature/Change Request
Package: *General Issues
PHP Version: 7.2.0RC5
Block user comment: N
Private report: N
New Comment:
byte alignment eliminates gaps between structures in the array when it doesn't come up to 16
bytes (usual default).
so byte alignment would take less memory overall.
Previous Comments:
------------------------------------------------------------------------
[2018-11-21 02:24:49] a at b dot c dot de
An anon class comes close, but associative arrays come closer.
time_t is not a struct, it's an arithmetic type with semantics that are explicitly undefined by
the standard. The value returned by PHP's time() function would be acceptable.
You're thinking of the tm struct, which is specified as having at least (possibly more) a
certain list of fields that are all defined as integers. The only thing missing from the array
returned by getdate() is the isDST field.
Byte alignment is a meaningless requirement for a PHP application.
------------------------------------------------------------------------
[2017-11-06 22:49:57] jmichae35 at gmail dot com
you might try implementing some particularly useful ones like windows' SYSTEM_TIME and struct
time_t.
------------------------------------------------------------------------
[2017-11-06 22:08:44] pollita@php.net
You're never going to find something like this in PHP because of the way PHP's memory
layout works.
------------------------------------------------------------------------
[2017-11-06 21:18:43] jmichae35 at gmail dot com
Description:
------------
need structs and unions like in C/C++. an anon class comes close, but is not quite it. and it needs
to have byte alignment.
Expected result:
----------------
struct {
...
}
...
union {
...
}
if you can obtain it from ANSI spec
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75491&edit=1
Thread (5 messages)