473,780 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

va_start and template functions do not compile under gcc 2.7.2

When I compile this file
------------------------------------------------------
#include <stdarg.h>
template <class Any>
void var_arg_func(in t dimension_count , ...)
{
int dimensions[4];
va_list ap;

va_start(ap, dimension_count ); // <- error
for (int i = 0; i < 3; i++)
{
dimensions[i] = va_arg(ap,int); // <- error
}
}
------------------------------------------------------
I get the following obscure error message:
test.cpp:10: sorry, not implemented: initializer contains unrecognized
tree code
test.cpp:15: sorry, not implemented: initializer contains unrecognized
tree code

If I make the function to be non-templated, it compiles.

Either version compiles under MSVC++ 6.0.

I am using the gcc 2.7.2 that ships with Tornado 2.0 from
WindRiver.

Can anyone explain this error message?
I need to get this code to compile.

I have a templated class that I wrote that implements a
multi-dimensional container. Since it is a container it must be
templated.
Being multi-dimensional the functions that require an index use
the elipsis ... operator.
Jul 19 '05 #1
4 3263
"frankg" <Fr**********@m otorola.com> wrote...
When I compile this file
------------------------------------------------------
[...]
------------------------------------------------------
I get the following obscure error message:
test.cpp:10: sorry, not implemented: initializer contains unrecognized ^^^^^^^^^^^^^^^ ^^^^^^^ tree code
[...]
I am using the gcc 2.7.2 that ships with Tornado 2.0 from
WindRiver.

Can anyone explain this error message?
I need to get this code to compile.


What word of "sorry, not implemented" do you not understand?

GCC has already progressed to the next major version. Perhaps
you need to update your compiler...

Victor
Jul 19 '05 #2
"frankg" wrote:
: When I compile this file
: ------------------------------------------------------
: #include <stdarg.h>
:
:
: template <class Any>
: void var_arg_func(in t dimension_count , ...)
: {
: int dimensions[4];
: va_list ap;
:
: va_start(ap, dimension_count ); // <- error
:
:
: for (int i = 0; i < 3; i++)
: {
: dimensions[i] = va_arg(ap,int); // <- error
: }
: }
: ------------------------------------------------------
: I get the following obscure error message:
: test.cpp:10: sorry, not implemented: initializer contains unrecognized
: tree code
: test.cpp:15: sorry, not implemented: initializer contains unrecognized
: tree code
:
: If I make the function to be non-templated, it compiles.
:
: Either version compiles under MSVC++ 6.0.
:
: I am using the gcc 2.7.2 that ships with Tornado 2.0 from
: WindRiver.
:
: Can anyone explain this error message?
: I need to get this code to compile.
:
: I have a templated class that I wrote that implements a
: multi-dimensional container. Since it is a container it must be
: templated.
: Being multi-dimensional the functions that require an index use
: the elipsis ... operator.

The code you posted assumes a set size of 3 integer arguments, so getting
that code to compile would be as simple as taking out the ellipses and
putting in an array argument and reading that. However, I don't think the
code you posted is what you want to actually compile (since your function is
parameterized but never uses the template parameter and the ellipses suggest
many possible numbers of arguments).

If the ellipses mean you just want to get passed a collection of values you
know are integers, just set a second argument of std::vector<int >, if they
are parametrized by the template, set a second argument of std::vector<Any >,
and if the arguments really must vary in type, you need to include a
descriptor argument which specifies what the format of those arguments are
and then you can try a std::vector<boo st::any> or some other generic type
container. I am not sure why your code will not compile, but there seem to
be several alternate designs that might be more typesafe as well as being
more likely to compile.

--
/////////////////////////////////////////////

galathaea: prankster, fablist, magician, liar
Jul 19 '05 #3
> What word of "sorry, not implemented" do you not understand?

GCC has already progressed to the next major version. Perhaps
you need to update your compiler...

Victor


Thank you for your courteous response. I am forced to use this version
of gcc because Windriver ships binary objects without source. If I try
to move to a newer version of gcc that has different parameter passing
assumptions bad things will happen.
Jul 19 '05 #4
frankg wrote:
What word of "sorry, not implemented" do you not understand?

GCC has already progressed to the next major version. Perhaps
you need to update your compiler...

Victor


Thank you for your courteous response. I am forced to use this version
of gcc because Windriver ships binary objects without source. If I try
to move to a newer version of gcc that has different parameter passing
assumptions bad things will happen.


I've never used C++ stuff in VxWorks, but there are folks around who
have switched to a never compiler with varying degrees of success.
You might try searching google. Also, you really are compiling
with g++ as opposed to gcc, aren't you? This is expecially important
if you are using a windows host as your development machine.

You might also call the local FAE and explain your specific
problem. They may have a workaround.

Speaking only for myself,

Joe Durusau
Jul 19 '05 #5

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

Similar topics

2
10162
by: Christophe Barbe | last post by:
I posted a few days ago about the same problem but was not very clear. So here is my second take at it. Basically with GCC 3.3.2, I can't compile the example from the C++ FAQ Lite available online at http://www.parashift.com/c++-faq-lite/containers-and-templates.html#faq-34.15 Below are the two files that I compile with g++ foo.cpp -o foo or
4
1503
by: velthuijsen | last post by:
I've been reading (and using the examples in) Thinking in C++ (vol 2). One of the things that the author shows you can do with templates is the following: #include <iostream> using namespace std; template<class T> class Counted
8
11367
by: vpadial | last post by:
Hello, I want to build a library to help exporting c++ functions to a scripting languagge. The scripting language provides a function to register functions like: ANY f0() ANY f1(ANY) ANY f2(ANY, ANY) ANY f3(ANY, ANY, ANY)
5
6589
by: Levent | last post by:
Hi, Why doesn't this work? (tried with gcc 3.3.3 and VC++ 7.1): #include <iostream> template<class T, unsigned N> struct Foo { void func(); }; template<class T, unsigned N>
9
2732
by: Ann Huxtable | last post by:
I have the following code segment - which compiles fine. I'm just worried I may get run time probs - because it looks like the functions are being overloaded by the return types?. Is this Ok: ? template <class T1, class T2> int getValue( T1 col, T2 row ) ; template <class T1, class T2> double getValue( T1 col, T2 row ) ;
3
16782
by: Douwe | last post by:
I try to build my own version of printf which just passes all arguments to the original printf. As long as I keep it with the single argument version everything is fine. But their is also a version which uses the "..." as the last parameter how can I pass them to the orignal printf ? void myprintf(char *txt, ...) printf(txt, ???????); }
6
1583
by: Hendrik Schober | last post by:
Hi, I have a problem with extending some existing code. In a simplified form, the problem looks like this: I have four types, A, B, C, and D. Each A refers to zero, one, or more B's and each B can be child to zero, one, or more A's. I just call that "A is a parent of B", and "B is a child of A". The same goes for B and C and for C and D. So A is only a parent, B and C are both parents and children, and D is only a child.
4
3356
by: stinos | last post by:
Hi All! suppose a class having a function for outputting data somehow, class X { template< class tType > void Output( const tType& arg ) { //default ToString handles integers/doubles
4
1599
by: Pallav singh | last post by:
Hi All, i am getting error during explicit function Instantiation for a class Template if i do explicit Instantiation of class it work and all function symbol i get in object file But if i try to expose only one function of my class its failing #include <iostream>
0
10306
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
10139
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7485
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
6727
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
5373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5504
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2869
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.