Native types can't be used with pointers.

Just starting out? Need help? Post your questions and find answers here.
User_Russian
Addict
Addict
Posts: 1550
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Native types can't be used with pointers.

Post 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?
Little John
Addict
Addict
Posts: 4791
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

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

Post 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.
User_Russian
Addict
Addict
Posts: 1550
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

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

Post by User_Russian »

But still not fixed.
It is not an error which requires stopping compilation. This should be a warning.
Fred
Administrator
Administrator
Posts: 18248
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

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

Post by Fred »

No.
Little John
Addict
Addict
Posts: 4791
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

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

Post 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).
User_Russian
Addict
Addict
Posts: 1550
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

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

Post by User_Russian »

Fred wrote:No.
Why?
Little John wrote:discussions here
Where?
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

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

Post 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
"Have you tried turning it off and on again ?"
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

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

Post 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"?
User_Russian
Addict
Addict
Posts: 1550
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

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

Post 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
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

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

Post 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)
User_Russian
Addict
Addict
Posts: 1550
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

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

Post 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.
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

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

Post 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.
User_Russian
Addict
Addict
Posts: 1550
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

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

Post 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: :?
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

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

Post by Danilo »

User_Russian wrote:But the development is entirely dependent on the position of Fred and the team.
Yes, that's absolutely correct.
User avatar
Crusiatus Black
Enthusiast
Enthusiast
Posts: 389
Joined: Mon May 12, 2008 1:25 pm
Location: The Netherlands
Contact:

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

Post 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?
Image
Bas Groothedde,
Imagine Programming

I live in a philosophical paradoxal randome filled with enigma's!
Post Reply