Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Don't forget to read Tuesday's email newsletter for your chance to win a free copy of Construct 2!


- - - - -

?: minor issue


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Desdemona   Members   -  Reputation: 158

Like
0Likes
Like

Posted 09 September 2004 - 05:37 PM

Shouldnt the 0 implicitly cast to Data* in both cases?
uint nw = get_refid("northwest");

Data* pNorthwest = nw == 0 ? 0 : Dataset[nw]; // Does not work
Data* pNorthwest = nw != 0 ? Dataset[nw] : 0; // Works

// Dataset[nw] returns Data*



Sponsor:

#2 Kevlar-X   Members   -  Reputation: 122

Like
0Likes
Like

Posted 09 September 2004 - 06:06 PM

I'm not one to ponder densly packed code for too long.
Why not try a structure more like the following:


uint nw = get_refid("northwest");
Data* pNorthwest = 0;
if(nw)
pNorthWest = Dataset[nw];


One more thing, what is stored at Dataset[0], and why is it not used?

- Jacob

#3 davepermen   Members   -  Reputation: 1017

Like
0Likes
Like

Posted 09 September 2004 - 06:21 PM

yeah, if Dataset[0] == 0, you can just

Data* pNorthwest = Dataset[get_refid("northwest")];
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia

My Page davepermen.net | My Music on Bandcamp and on Soundcloud


#4 Desdemona   Members   -  Reputation: 158

Like
0Likes
Like

Posted 09 September 2004 - 06:50 PM

The comment was aimed more at a quirk in the langauge, not the actual code

#5 Kevlar-X   Members   -  Reputation: 122

Like
0Likes
Like

Posted 09 September 2004 - 07:11 PM

[edit]
Removed response, as it was related to C++ and not Angelcode.
[/edit]

WitchLord: Thanks for pointing that out. I didn't look at the forum the message was posted in, simply the topic/and post itself.
My mistake :(

Desdemona: In the future, please specify the question fully to help avoid confusion like this.
(There is a trend for people to ask questions about programming, and simply imply the language is C++. However you did the right thing and posted in the correct forum at least!)


[Edited by - Kevlar-X on September 10, 2004 12:11:21 PM]

#6 Andreas Jonsson   Moderators   -  Reputation: 3416

Like
0Likes
Like

Posted 10 September 2004 - 04:40 AM

davepermen and Kevlar-X:

You're missing the point [wink]. Because Desdemona's question was posted in my forum (AngelCode), I implicitly understand that the code he wrote is for AngelScript. I suppose you entered from Active Topics, in which case I can understand why you would think he's asking about normal C++ code.

Desdemona:

You're right, 0 ought to be implicitly converted to Data* in this case. AngelScript doesn't do it as it compiles 0 first and finds that it is an integer, thus it expects the second case to be integer as well. I'll see if I can fix this one, for the next versions.

Thanks for letting me know.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS