D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6583 - cast() operation not fully specified
Summary: cast() operation not fully specified
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dlang.org (show other issues)
Version: D2
Hardware: Other All
: P3 normal
Assignee: No Owner
URL:
Keywords: pull, spec, trivial
Depends on:
Blocks:
 
Reported: 2011-08-30 22:41 UTC by Lennart Blanco
Modified: 2023-01-31 12:04 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Lennart Blanco 2011-08-30 22:41:57 UTC
The D2 language specification does not fully define the conversation performed by cast() operation, http://d-programming-language.org/expression.html#CastExpression.

For example cast() between basic data types of different sizes and signess is not described.

e.g:

  int a;
  byte b = cast(int)a;

Casting pointers to basic data types is also not described.

I think the specification should define when the value is truncated, sign extended or copied bit-by-bit, etc.

Maybe a reference to relevant C language specification would solve this issue.
Comment 1 Dlang Bot 2023-01-30 13:00:14 UTC
@Robert21721 updated dlang/dlang.org pull request #3502 "Fix Issue  6583 - cast() operation not fully specified" fixing this issue:

- fix issue 6583 - cast() operation not fully specified

https://github.com/dlang/dlang.org/pull/3502
Comment 2 Dlang Bot 2023-01-31 12:04:05 UTC
dlang/dlang.org pull request #3502 "Fix Issue  6583 - cast() operation not fully specified" was merged into master:

- e858a2e893209972fcc08994780fa139c7e5c4e0 by Robert21721:
  fix issue 6583 - cast() operation not fully specified

https://github.com/dlang/dlang.org/pull/3502