On 6/15/25 9:06 AM, Steven Schveighoffer wrote:
On Monday, 9 June 2025 at 07:24:41 UTC, confuzzled wrote:
Hello community,
Is it possible to accomplish the following using ref instead of
pointers? If so, please share an example.
A ref cannot be a member of a type. But ref can be returned by
Good day all,
What is the proper way to assign to accomplish this?
ulong rdtsc() {
ulong result;
uint* res = cast(uint*) &result;
asm {
rdtsc; // Puts result in edx:eax
// Cast our ulong's address to a 32-bit integer pointer
// and move the register values i
On Thursday, 20 February 2025 at 10:05:13 UTC, Danny Arends wrote:
Running into some weird linker issues within
bindbc.common.codegen:
```
/usr/bin/ld:
/home/danny/.dub/cache/betterct/~master/build/betterC-debug-gZx8lRyN8EaQ6hq_UuhHCw/betterct.o:(.data._D39TypeInfo_S6bindbc6common7codegen6FnBi
```d
import std;
unittest{
int[0] callstack;
(&callstack).writeln;
(&callstack+1000).writeln;
}
```
this prints the same value twice, I assume its some kind of void
replacement, then an optimizer, then related to whatever os
memory magic does some math.
```d
import std.stdio;
__gshared int literal;
void main() {
int[0] callstack;
(&callstack+literal).writeln;
}
```
```asm
_Dmain:
.Lfunc_begin0:
.file 1 "/" "app/example.d"
.loc1 5 0
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
On Saturday, 28 June 2025 at 08:11:53 UTC, realhet wrote:
On Thursday, 26 June 2025 at 16:40:10 UTC, Steven Schveighoffer
wrote:
On Tuesday, 24 June 2025 at 08:48:16 UTC, realhet wrote:
For those who run into this problem: These are really illegal
things in the destructors:
- GC allocation.
On Friday, 4 July 2025 at 08:17:34 UTC, Richard (Rikki) Andrew
Cattermole wrote:
```d
import std.stdio;
__gshared int literal;
void main() {
int[0] callstack;
(&callstack+literal).writeln;
}
```
```asm
_Dmain:
.Lfunc_begin0:
.file 1 "/" "app/example.d"
.loc1 5 0
```d
struct Vector
{
float x, y;
Vector opBinary(string op)(inout Vector rhs) const if (op ==
"+")
{
return Vector(mixin("x", op, "rhs.x"), mixin("y", op,
"rhs.y"),);
}
ref Vector opOpAssign(string op)(inout Vector rhs) if (op ==
"+" || op == "-")
{
On Friday, 4 July 2025 at 17:15:48 UTC, partypooper wrote:
```d
struct Vector
{
float x, y;
Vector opBinary(string op)(inout Vector rhs) const if (op
== "+")
{
return Vector(mixin("x", op, "rhs.x"), mixin("y", op,
"rhs.y"),);
}
ref Vector opOpAssign(string op)(in
On Friday, 4 July 2025 at 17:34:59 UTC, monkyyy wrote:
On Friday, 4 July 2025 at 17:15:48 UTC, partypooper wrote:
if you add ref to line 28 it works; there wont be a reasonable
way to make an error happen, you just have to know when to do
refness
It doesn't work. Or it works even worse: chang
```d
auto bar(int i){
foo()
}
unittest{
bar(3);
}
```
Given any definition of foo, any compiler bugs, how would you
detect the `3` from `foo`?
___
My attempts at scanning the call stack didn't work but for anyone
attempting it, I believe this breakdown of control flow may be
part of the
On Friday, 4 July 2025 at 18:04:55 UTC, partypooper wrote:
It doesn't work. Or it works even worse: changing _pos, but not
_dest. What is going on is that on `+=` it for some reason
invokes "getter", not "setter". I specifically omitted "ref",
because I already have known of that behavior.
In
On 7/5/25 1:06 AM, confuzzled wrote:
ulong rdtsc() {
ulong result;
uint* res = cast(uint*) &result;
asm {
rdtsc; // Puts result in edx:eax
// Cast our ulong's address to a 32-bit integer pointer
// and move the register values into the correct memory lo
13 matches
Mail list logo