Anonymous | Login | 2024-10-14 23:47 UTC |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||
ID | Category | Severity | Type | Date Submitted | Last Update | ||
0001106 | [1003.1(2016/18)/Issue7+TC2] Base Definitions and Headers | Editorial | Enhancement Request | 2016-12-07 14:11 | 2018-05-24 15:28 | ||
Reporter | EdSchouten | View Status | public | ||||
Assigned To | ajosey | ||||||
Priority | normal | Resolution | Rejected | ||||
Status | Closed | ||||||
Name | Ed Schouten | ||||||
Organization | Nuxi | ||||||
User Reference | |||||||
Section | <stdlib.h> | ||||||
Page Number | - | ||||||
Line Number | - | ||||||
Interp Status | --- | ||||||
Final Accepted Text | |||||||
Summary | 0001106: *rand48(): Should this use uint16_t instead of unsigned short? | ||||||
Description |
The *rand48() functions implement a 48-bits linear congruential generator PRNG. The state of this PRNG is stored in an array of three values of type unsigned short. For example: long jrand48(unsigned short xsubi[3]); POSIX requires that two's-complement is used and unsigned short is at least 16 bits in size, meaning that in our context unsigned short is sufficient. Still, it looks kind of odd. Modern code that would want to model a 48-bit integer this way would use an array of uint16_t's. I would therefore like to propose that the prototypes of these functions are adjusted. This should have little to no impact on compatibility, as (almost?) all POSIX-like systems define unsigned short and uint16_t equally. |
||||||
Desired Action |
Proposed changes: ---------------------------------------------------------------------- In article http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdlib.h.html [^] : - Under "The <stdlib.h> header shall define the following data types through typedef", add the following: [XSI]uint16_t As described in <stdint.h>.[XSI] - Replace all occurrences of 'unsigned short' with 'uint16_t'. In article http://pubs.opengroup.org/onlinepubs/9699919799/functions/drand48.html [^] : - Replace all occurrences of 'unsigned short' with 'uint16_t'. ---------------------------------------------------------------------- Using the same reasoning, the typing of jrand48(), lrand48(), mrand48() and nrand48() could be improved to return a value of type int32_t. That said, such a change could potentially break compatibility with existing code. Similar problems apply to a64l() and l64a() as well. |
||||||
Tags | No tags attached. | ||||||
Attached Files | |||||||
|
Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group |