Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   Error question. (http://www.velocityreviews.com/forums/t456977-error-question.html)

JoeC 09-18-2006 06:16 PM

Error question.
 
I am trying to write a program and I send a pointer to an object to
another object and I want to get a number out of that object It is
strange this works:

static mapmgt m(b, trn, b->GetSizeX(), b->GetSizeY());

but this doesn't work:

static mapmgt m(b, trn){
xlen = b->GetSizeX();


Thomas Tutone 09-18-2006 06:25 PM

Re: Error question.
 

JoeC wrote:

> I am trying to write a program and I send a pointer to an object to
> another object and I want to get a number out of that object It is
> strange this works:
>
> static mapmgt m(b, trn, b->GetSizeX(), b->GetSizeY());
>
> but this doesn't work:
>
> static mapmgt m(b, trn){
> xlen = b->GetSizeX();


Why is it strange? Please post the definition of mapmgt, a complete
compilable piece of code that duplicates the error, and the exact error
message you get.

Best regards,

Tom


JoeC 09-18-2006 07:11 PM

Re: Error question.
 

Thomas Tutone wrote:
> JoeC wrote:
>
> > I am trying to write a program and I send a pointer to an object to
> > another object and I want to get a number out of that object It is
> > strange this works:
> >
> > static mapmgt m(b, trn, b->GetSizeX(), b->GetSizeY());
> >
> > but this doesn't work:
> >
> > static mapmgt m(board * b, ....
> > xlen = b->GetSizeX();

>
> Why is it strange? Please post the definition of mapmgt, a complete
> compilable piece of code that duplicates the error, and the exact error
> message you get.
>
> Best regards,
>


I am going with the first first function. The program is large and
complex. b is apointer and I can get the numbers that way but if I
send the pointer to the function it said somthing like the some value
is not an int when it is. I am just going with what what works.
> Tom



Howard 09-18-2006 08:09 PM

Re: Error question.
 

"JoeC" <enki034@yahoo.com> wrote in message
news:1158606701.161470.62970@b28g2000cwb.googlegro ups.com...
>
> Thomas Tutone wrote:
>> JoeC wrote:
>>
>> > I am trying to write a program and I send a pointer to an object to
>> > another object and I want to get a number out of that object It is
>> > strange this works:
>> >
>> > static mapmgt m(b, trn, b->GetSizeX(), b->GetSizeY());
>> >
>> > but this doesn't work:
>> >


What doesn't work?

>> > static mapmgt m(board * b, ....


Why do you have "board *" there? I assume you're creating a local static
object of type mapmgt, called m. Correct? In that case, ditch the "board
*" part, and just pass the parameter values.

>> > xlen = b->GetSizeX();


Perhaps you really meant to do something like this: ?

// in some function...
{
...
int xlen = b->GetSizeX();
int ylen = b->GetSizeY();
static mapmgt m(b, trn, xlen, ylen);
....
}

In which case, if you don't xlen and ylen elsewhere, why bother? Your first
example is fine.

>>
>> Why is it strange? Please post the definition of mapmgt, a complete
>> compilable piece of code that duplicates the error, and the exact error
>> message you get.
>>
>> Best regards,
>>

>
> I am going with the first first function. The program is large and
> complex. b is apointer and I can get the numbers that way but if I
> send the pointer to the function it said somthing like the some value
> is not an int when it is. I am just going with what what works.


That's fine, but in the future, if you want help, you'll need to post code
that's real, even if you change the names and even if you can only post a
few lines actually related to the error. Also, post the actual text of the
error message, not "it said somthing like the some value is not an int when
it is".

-Howard



JoeC 09-18-2006 08:42 PM

Re: Error question.
 

Howard wrote:
> "JoeC" <enki034@yahoo.com> wrote in message
> news:1158606701.161470.62970@b28g2000cwb.googlegro ups.com...
> >
> > Thomas Tutone wrote:
> >> JoeC wrote:
> >>
> >> > I am trying to write a program and I send a pointer to an object to
> >> > another object and I want to get a number out of that object It is
> >> > strange this works:
> >> >
> >> > static mapmgt m(b, trn, b->GetSizeX(), b->GetSizeY());
> >> >
> >> > but this doesn't work:
> >> >

>
> What doesn't work?
>
> >> > static mapmgt m(board * b, ....

>
> Why do you have "board *" there? I assume you're creating a local static
> object of type mapmgt, called m. Correct? In that case, ditch the "board
> *" part, and just pass the parameter values.
>
> >> > xlen = b->GetSizeX();

>
> Perhaps you really meant to do something like this: ?
>
> // in some function...
> {
> ...
> int xlen = b->GetSizeX();
> int ylen = b->GetSizeY();
> static mapmgt m(b, trn, xlen, ylen);
> ...
> }
>
> In which case, if you don't xlen and ylen elsewhere, why bother? Your first
> example is fine.
>
> >>
> >> Why is it strange? Please post the definition of mapmgt, a complete
> >> compilable piece of code that duplicates the error, and the exact error
> >> message you get.
> >>
> >> Best regards,
> >>

> >
> > I am going with the first first function. The program is large and
> > complex. b is apointer and I can get the numbers that way but if I
> > send the pointer to the function it said somthing like the some value
> > is not an int when it is. I am just going with what what works.

>
> That's fine, but in the future, if you want help, you'll need to post code
> that's real, even if you change the names and even if you can only post a
> few lines actually related to the error. Also, post the actual text of the
> error message, not "it said somthing like the some value is not an int when
> it is".
>
> -Howard


OK, thanks. some times it can be dificult to post revelent lines of
code from a complex program. I do have another question which I will
start another topic.



All times are GMT. The time now is 09:49 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.