473,603 Members | 2,635 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Take paramaters as one pointer?

I will start a new discussion about this issue here.

The question popped up after investigating an other issue:
http://groups.google.fi/group/comp.l...07f29eaecd75c3
Maybe a separate discussion would be good for this.
Do you know how several arguments can be passed to an other method
through an intermediate method?
The intemediate method should not need to know how many arguments are
used. The intermediate method should not need to know the types of the
arguments either.

Is it possible to pass the arguments that way?

method1 -passes several arguments with different types to ->
intermediateMet hod(use some kind of a pointer to args?)

Then intermediateMet hod passes the arguments to -finalMethod1.
(And finalMethod read the arguments and passes the values one more time
to a library.)

The task above happen inside a wrapper class
(, which should e.g. convert the exception to a different type of
exception in the intermediateMet hod).

Is it possible to pass the arguments behind a pointer?
finalMethod would read the arguments from the pointer, which it gets?
Or some other way.

I do not know is this possible.
I have seen this kind of a functionality e.g. when using threads,
arguments can be given to threads, and threads can read the arguments,
or there is also similar functionality in main: in "int
main(...argv... )".

I do not know would this kind of a functionality be easy to implement.

Nov 15 '06 #1
3 1169
a_*****@yahoo.c om wrote:
I will start a new discussion about this issue here.

The question popped up after investigating an other issue:
http://groups.google.fi/group/comp.l...07f29eaecd75c3
Maybe a separate discussion would be good for this.
Do you know how several arguments can be passed to an other method
through an intermediate method?
The intemediate method should not need to know how many arguments are
used. The intermediate method should not need to know the types of the
arguments either.

Is it possible to pass the arguments that way?

method1 -passes several arguments with different types to ->
intermediateMet hod(use some kind of a pointer to args?)

Then intermediateMet hod passes the arguments to -finalMethod1.
(And finalMethod read the arguments and passes the values one more time
to a library.)

The task above happen inside a wrapper class
(, which should e.g. convert the exception to a different type of
exception in the intermediateMet hod).

Is it possible to pass the arguments behind a pointer?
finalMethod would read the arguments from the pointer, which it gets?
Or some other way.

I do not know is this possible.
I have seen this kind of a functionality e.g. when using threads,
arguments can be given to threads, and threads can read the arguments,
or there is also similar functionality in main: in "int
main(...argv... )".

I do not know would this kind of a functionality be easy to implement.
You could use a std::vector<boo st::any>. See
http://boost.org/doc/html/any.html.

Cheers! --M

Nov 15 '06 #2
>
You could use a std::vector<boo st::any>. See
http://boost.org/doc/html/any.html.

Cheers! --M

Thank you!

Actually I would/will probably use void pointers in the vector
(vector<void*>) ,
but the main idea is the same as with boost::any.
Thanks for the idea!

Nov 16 '06 #3
a_*****@yahoo.c om wrote:

You could use a std::vector<boo st::any>. See
http://boost.org/doc/html/any.html.

Cheers! --M


Thank you!

Actually I would/will probably use void pointers in the vector
(vector<void*>) ,
but the main idea is the same as with boost::any.
Thanks for the idea!
I'd recommend against that approach. The Boost.Any documentation offers
this warning:

"[A third kind of generic types are] [i]ndiscriminate types that can
refer to anything but are oblivious to the actual underlying type,
entrusting all forms of access and interpretation to the programmer.
This niche is dominated by void *, which offers plenty of scope for
surprising, undefined behavior."

Cheers! --M

Nov 16 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1359
by: bjam | last post by:
Hi, I am trying to do the following, which is to have a single place to define my table paramaters such as cellpadding / cellspacing etc. Below is the code I am trying to achieve see the cell spacing element in the table html tag below. Thanks in advance for any help you can provide. I really appreciate it. This is currently not working as I can't have an xsl:value-of select inside of the table tag itself... does anyone have any ideas...
51
2524
by: Richard Hengeveld | last post by:
Hi all, I'm trying to understand how pointers for function parameters work. As I understand it, if you got a function like: void f(int *i) { *i = 0; }
209
8671
by: arnuld | last post by:
I searched the c.l.c archives provided by Google as Google Groups with "word input" as the key words and did not come up with anything good. C++ has std::string for taking a word as input from stdin. C takes input in 2 ways: 1) as a character, etchar() 2) as a whole line, fgets()
0
7996
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7928
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8415
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8273
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6735
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5878
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5441
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3951
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1514
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.