On Mon, Nov 25, 2019 at 08:39:08PM +, Fanda Vacek via Digitalmars-d-learn
wrote:
> On Monday, 25 November 2019 at 08:32:53 UTC, H. S. Teoh wrote:
> > On Mon, Nov 25, 2019 at 08:07:50AM +, Fanda Vacek via
> > Digitalmars-d-learn wrote: [...]
> > > But anyway, pointers are not allowed in
On Monday, 25 November 2019 at 09:00:49 UTC, Dukc wrote:
On Monday, 25 November 2019 at 03:07:08 UTC, Fanda Vacek wrote:
Is this preferred design pattern?
```
int main()
{
int a = 1;
//ref int b = a; // Error: variable `tst_ref.main.b` only
parameters or `foreach` declarations can be
On Monday, 25 November 2019 at 08:32:53 UTC, H. S. Teoh wrote:
On Mon, Nov 25, 2019 at 08:07:50AM +, Fanda Vacek via
Digitalmars-d-learn wrote: [...]
But anyway, pointers are not allowed in @safe code, so this is
not always solution.
[...]
This is incorrect. Pointers *are* allowed in
On 25.11.19 10:00, Dukc wrote:
On Monday, 25 November 2019 at 03:07:08 UTC, Fanda Vacek wrote:
Is this preferred design pattern?
```
int main()
{
int a = 1;
//ref int b = a; // Error: variable `tst_ref.main.b` only
parameters or `foreach` declarations can be `ref`
ref int b() {
On Monday, November 25, 2019 1:32:53 AM MST H. S. Teoh via Digitalmars-d-
learn wrote:
> On Mon, Nov 25, 2019 at 08:07:50AM +, Fanda Vacek via
> Digitalmars-d-learn wrote: [...]
>
> > But anyway, pointers are not allowed in @safe code, so this is not
> > always solution.
>
> [...]
>
> This is
On Monday, 25 November 2019 at 03:07:08 UTC, Fanda Vacek wrote:
Is this preferred design pattern?
```
int main()
{
int a = 1;
//ref int b = a; // Error: variable `tst_ref.main.b` only
parameters or `foreach` declarations can be `ref`
ref int b() { return a; }
b = 2;
On Mon, Nov 25, 2019 at 08:07:50AM +, Fanda Vacek via Digitalmars-d-learn
wrote:
[...]
> But anyway, pointers are not allowed in @safe code, so this is not
> always solution.
[...]
This is incorrect. Pointers *are* allowed in @safe code. Pointer
*arithmetic* is not allowed.
--T
On Monday, 25 November 2019 at 08:20:59 UTC, rumbu wrote:
On Monday, 25 November 2019 at 08:07:50 UTC, Fanda Vacek wrote:
Thanks for answer, I'm coming from C++. But anyway, pointers
are not allowed in @safe code, so this is not always solution.
Workaround exits even for @safe code, so my
On Monday, 25 November 2019 at 08:07:50 UTC, Fanda Vacek wrote:
Thanks for answer, I'm coming from C++. But anyway, pointers
are not allowed in @safe code, so this is not always solution.
Workaround exits even for @safe code, so my question remains
the same. What is a rationale for such a
On Monday, 25 November 2019 at 05:51:31 UTC, Rumbu wrote:
On Monday, 25 November 2019 at 03:07:08 UTC, Fanda Vacek wrote:
Maybe I'm missing the thing, but I'm not able to declare local
ref variable even if simple workaround exists. Is this
preferred design pattern?
```
int main()
{
On Monday, 25 November 2019 at 03:07:08 UTC, Fanda Vacek wrote:
Maybe I'm missing the thing, but I'm not able to declare local
ref variable even if simple workaround exists. Is this
preferred design pattern?
```
int main()
{
int a = 1;
//ref int b = a; // Error: variable
Maybe I'm missing the thing, but I'm not able to declare local
ref variable even if simple workaround exists. Is this preferred
design pattern?
```
int main()
{
int a = 1;
//ref int b = a; // Error: variable `tst_ref.main.b` only
parameters or `foreach` declarations can be `ref`
12 matches
Mail list logo