Page 1 of 2

Native types can't be used with pointers.

Posted: Mon May 12, 2014 5:40 pm
by User_Russian
Why is this a fatal error rather than a compiler warning as in case of function CreateGadgetList()?
Why presence of type at the pointer does not allow the code to compile? Prior to version 5.10, it was not a problem, and now a fatal error, with a stop compilation! Why?

Re: Native types can't be used with pointers.

Posted: Mon May 12, 2014 6:02 pm
by Little John
User_Russian wrote:Why is this a fatal error rather than a compiler warning as in case of function CreateGadgetList()?
Why presence of type at the pointer does not allow the code to compile?
This has already been discussed repeatedly here on the forum.

Re: Native types can't be used with pointers.

Posted: Mon May 12, 2014 7:02 pm
by User_Russian
But still not fixed.
It is not an error which requires stopping compilation. This should be a warning.

Re: Native types can't be used with pointers.

Posted: Mon May 12, 2014 7:14 pm
by Fred
No.

Re: Native types can't be used with pointers.

Posted: Mon May 12, 2014 7:16 pm
by Little John
User_Russian wrote:But still not fixed.
There is nothing to "fix" in this respect.
You can read more detailed information in the previous discussions here (that's why I mentioned them).

Re: Native types can't be used with pointers.

Posted: Mon May 12, 2014 10:21 pm
by User_Russian
Fred wrote:No.
Why?
Little John wrote:discussions here
Where?

Re: Native types can't be used with pointers.

Posted: Mon May 12, 2014 11:22 pm
by luis
User_Russian wrote: Why?
Where?
One of the many threads about it, here you can read different opinions on the subject and the reasons behind the change

http://www.purebasic.fr/english/viewtop ... 13&t=52873

Re: Native types can't be used with pointers.

Posted: Tue May 13, 2014 12:40 am
by rsts
User_Russian wrote:
Little John wrote:discussions here
Where?
For someone who talks about how smart they are, you've never heard of "search"?

Re: Native types can't be used with pointers.

Posted: Tue May 13, 2014 9:09 am
by User_Russian
But the compiler can such string

Code: Select all

*Point.l
convert to

Code: Select all

*Point.long
And then all will be well.
Why, instead this is error? :?
luis wrote:One of the many threads about it, here you can read different opinions on the subject and the reasons behind the change
In the second post of topic, Fred did not answer. :?

I have the same situation as the author, the topic on your link.

Code: Select all

Macro LongLong : q : EndMacro

x.LongLong
*y.LongLong

Re: Native types can't be used with pointers.

Posted: Tue May 13, 2014 9:26 am
by Danilo
User_Russian wrote:I have the same situation as the author, the topic on your link.

Code: Select all

Macro LongLong : q : EndMacro

x.LongLong
*y.LongLong
You couldn't access the quad value on the pointer in a structured way (*y\q doesn't work with native types),
so you have to use another way.

Code: Select all

Macro LongLong    : q    : EndMacro
Macro LongLongPtr : Quad : EndMacro

x.LongLong = 12345
*y.LongLongPtr = @x
Debug *y\q

*y = @x
Debug PeekQ(*y)

*y_LongLong = @x
Debug PeekQ(*y_LongLong)

Re: Native types can't be used with pointers.

Posted: Tue May 13, 2014 9:37 am
by User_Russian
The use of different types (macro), for variable and pointer, it is "dirty" code!

Above cited the example of automatic type conversion from l to Long.

Re: Native types can't be used with pointers.

Posted: Tue May 13, 2014 9:47 am
by Danilo
User_Russian wrote:The use of different types (macro), for variable and pointer, it is "dirty" code!
It is your choice. You can use:
- *x (without any type)
- *x.LongLongPtr
- incorporate the type in the name: *x_LongLong

Use what you want, all 3 options work.
User_Russian wrote:Above cited the example of automatic type conversion from l to Long.
I suggested this, too, back when the change was made. As you can see, it got not changed to this way, as they didn't like it.

You are really late. It has all been discussed extensively, and nothing got changed.
They will not change it now, just because User_Russian wants the change. Get used to it.

Re: Native types can't be used with pointers.

Posted: Tue May 13, 2014 10:08 am
by User_Russian
Danilo wrote:They will not change it now, just because User_Russian wants the change. Get used to it.
This is unacceptable for a paid product! We bought a PB and I think we have the right not to influence its development.
But the development is entirely dependent on the position of Fred and the team. The majority opinion does not mean anything! :shock: :?

Re: Native types can't be used with pointers.

Posted: Tue May 13, 2014 10:25 am
by Danilo
User_Russian wrote:But the development is entirely dependent on the position of Fred and the team.
Yes, that's absolutely correct.

Re: Native types can't be used with pointers.

Posted: Tue May 13, 2014 11:05 am
by Crusiatus Black
I don't see why this is still a discussion topic. I think it is only logical that this isn't permitted
by the compiler any more. Also, a structure as 'type' for the pointer is logical, because it allows
for accessing the structure fields in that specific block of memory.

I never thought native types on pointers were logical in PureBasic, I mean, it's not like you could
do stuff like this:

Code: Select all

float *buffer = (float *)malloc(20);
*(buffer + 10) = 11.52;
In PureBasic. Structured 'types' were always required to do so (.Float)

Code: Select all

*test.Float = AllocateMemory(20)
*test + 10
*test\f = 11.52
Anyhow, we all know this is probably not going to change, so why not move on right?