Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

function 3 parameters, but called with 2 arguments

37 views
Skip to first unread message

pedr...@lycos.com

unread,
Jul 25, 2015, 9:24:26 PM7/25/15
to
I came across this with 3 parameters

void Interpwrap::setConvFunc (InterpConvFunc func, void *obj2, int num_bytes)
{
_conv_func = func;
_conv_obj2 = obj2;
_conv_val_len = num_bytes;
}

The only call anywhere in package has 2 arguments

setConvFunc (defaultConvFunc, this);

num_bytes is defined as 4 in a header file.
With a 64-bit compiler (gcc, Intel or open64) _conv_val_len ends up as 8.
Okay with 32-bit compilers.
What happened?

JiiPee

unread,
Jul 25, 2015, 9:47:36 PM7/25/15
to
I guess people need to see more code to know what happened. maybe there
are some defines or something...

bartekltg

unread,
Jul 25, 2015, 10:01:46 PM7/25/15
to
On 26.07.2015 03:24, pedr...@lycos.com wrote:
> I came across this with 3 parameters
>
> void Interpwrap::setConvFunc (InterpConvFunc func, void *obj2, int num_bytes)
> {
> _conv_func = func;
> _conv_obj2 = obj2;
> _conv_val_len = num_bytes;
> }
>
> The only call anywhere in package has 2 arguments
>
> setConvFunc (defaultConvFunc, this);

> num_bytes is defined as 4 in a header file.

this has nothing to do with the problem. In method you create
new variable with the same name.

> With a 64-bit compiler (gcc, Intel or open64) _conv_val_len ends up as 8.
> Okay with 32-bit compilers.
> What happened?

Are you sure there isn't a second, overloaded version?
If you use semi decent IDE, you can click on a call to function
(a function name in the line
setConvFunc (defaultConvFunc, this); )
and under context menu there should be something
like 'follow symbol under cursor F2'.

bartekltg






Melzzzzz

unread,
Jul 25, 2015, 10:22:01 PM7/25/15
to
On Sun, 26 Jul 2015 04:01:36 +0200
bartekltg <bart...@gmail.com> wrote:

> On 26.07.2015 03:24, pedr...@lycos.com wrote:
> > I came across this with 3 parameters
> >
> > void Interpwrap::setConvFunc (InterpConvFunc func, void *obj2, int
> > num_bytes) {
> > _conv_func = func;
> > _conv_obj2 = obj2;
> > _conv_val_len = num_bytes;
> > }
> >
> > The only call anywhere in package has 2 arguments
> >
> > setConvFunc (defaultConvFunc, this);
>
> > num_bytes is defined as 4 in a header file.
>
> this has nothing to do with the problem. In method you create
> new variable with the same name.
>
> > With a 64-bit compiler (gcc, Intel or open64) _conv_val_len ends up
> > as 8. Okay with 32-bit compilers.
> > What happened?
>
> Are you sure there isn't a second, overloaded version?

Could be also default argument declared in header...

Victor Bazarov

unread,
Jul 26, 2015, 8:47:01 AM7/26/15
to
Look at the declaration of that member in 'Interpwrap' class.

V
--
I do not respond to top-posted replies, please don't ask

red floyd

unread,
Jul 27, 2015, 12:16:35 PM7/27/15
to
Sounds like it, since he says "num_bytes is defined as
0 new messages