Hi
I have a Problem with my static vector which I defined. I'm using LTIB
Library looks like this:
test.h
class test
{
public:
static lti:channel8 img
}
test.cpp
include .....
lti:channel8 test::img(int sizex,int sizey,(byte) 0)
test::test()......
void test::create()
{
sizex = 6
sizey = 7
lti:channel8 test::img(sizex,sizey,0) //I get the size I need only here
so how do I initialize it correct
}
Anyone has an idea.
Thanks
Patrick 5 1270
On Tue, 26 Oct 2004 10:46:39 +0200, "Patrick"
<th**********@spamgourmet.com> wrote: Hi
I have a Problem with my static vector which I defined. I'm using LTIB Library looks like this:
test.h
class test { public: static lti:channel8 img
Shouldn't this have two colons?
[the rest snipped]
--
Bob Hairgrove No**********@Home.com
"Patrick" <th**********@spamgourmet.com> wrote in message
news:cl**********@home.itg.ti.com... Hi
I have a Problem with my static vector which I defined. I'm using LTIB Library looks like this:
test.h
class test { public: static lti:channel8 img }
test.cpp
include .....
lti:channel8 test::img(int sizex,int sizey,(byte) 0)
test::test()......
void test::create() { sizex = 6 sizey = 7 lti:channel8 test::img(sizex,sizey,0) //I get the size I need only here so how do I initialize it correct }
Anyone has an idea.
Thanks
Patrick
You should define the static members and this should be done outside any
method or function and in the same namespace as the class containing it.
Take this statement outside the create method.
lti::channel8 test::img(sizex,sizey,0)
And it should be lti::channel8 instead of lti:channel8
Catalin
Hi
The Colons are not the Problem this is only a functional demonstration.
The Problem is how do i init it correct so I get hte right contructor
initialization. Because outside of my function I don't have the right
values.
Patrick
"Bob Hairgrove" <in*****@bigfoot.com> wrote in message
news:eh********************************@4ax.com... On Tue, 26 Oct 2004 10:46:39 +0200, "Patrick" <th**********@spamgourmet.com> wrote:
Hi
I have a Problem with my static vector which I defined. I'm using LTIB Library looks like this:
test.h
class test { public: static lti:channel8 img
Shouldn't this have two colons?
[the rest snipped]
-- Bob Hairgrove No**********@Home.com I have a Problem with my static vector which I defined. I'm using LTIB Library looks like this:
test.h
class test { public: static lti::channel8 img }
test.cpp
include .....
lti:channel8 test::img(int sizex,int sizey,(byte) 0)
test::test()......
void test::create() { sizex = 6 sizey = 7 lti:channel8 test::img(sizex,sizey,0) //I get the size I need only
here so how do I initialize it correct }
Anyone has an idea.
Thanks
Patrick
You should define the static members and this should be done outside any method or function and in the same namespace as the class containing it. Take this statement outside the create method.
lti::channel8 test::img(sizex,sizey,0)
And it should be lti::channel8 instead of lti:channel8
Catalin
Hi
I already did that but I don't have the values of this variables outside of
my create method.
Patrick
"Patrick" <th**********@spamgourmet.com> wrote in message news:<cl**********@home.itg.ti.com>... I have a Problem with my static vector which I defined. I'm using LTIB Library looks like this:
test.h
class test { public: static lti:channel8 img }
test.cpp
include .....
lti:channel8 test::img(int sizex,int sizey,(byte) 0)
test::test()......
void test::create() { sizex = 6 sizey = 7 lti:channel8 test::img(sizex,sizey,0) //I get the size I need only here so how do I initialize it correct }
A class static variable will be constructed before main() executes. There
is nothing you can do about that.
So, if you don't have the necessary information to properly create the
object until runtime, you have a couple of choices:
1) Instead of having a static object, have a static pointer and new the
object at runtime.
2) If the type supports assignment, construct it with dummy values and then
at runtime, assign an instance constructed with the real vaulues.
Good luck,
samuel This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: cppaddict |
last post by:
I would like to know the best way to initialize complex static member
variables. In addition, I want to avoid creating an Init() method
that is called by the ctor, since there's no need to wait...
|
by: Bryan Parkoff |
last post by:
I know how to write "Pointer to Function" inside struct or class without
using static, but I have decided to add static to all functions inside
struct or class because I want member functions to be...
|
by: paulw |
last post by:
Hi
I have a question:
main() { static int i;
printf("%d\n",i); // should I see see 0 or 5 ???
for (i=5;i<=15;i++) {...} // What's the meaning of static
variable in
|
by: Ed Sutton |
last post by:
I use a mutex to disallow starting a second application instance. This
did not work in a release build until I made it static member of my
MainForm class.
In a debug build, first instance got...
|
by: Dennis |
last post by:
I have a function which is called from a loop many times. In that function,
I use three variables as counters and for other purposes. I can either use
DIM for declaring the variables or Static. ...
|
by: Per Bull Holmen |
last post by:
Hey
Im new to c++, so bear with me. I'm used to other OO languages, where it
is possible to have class-level initialization functions, that
initialize the CLASS rather than an instance of it....
|
by: Jeroen |
last post by:
Hi all,
I've got a question about writing a library. Let me characterize that
library by the following:
* there is a class A which is available to the user
* there is a class B that is used...
|
by: askcq |
last post by:
static int init=0;
main() {
void func1 (int);
void func2 (int);
func1(init);
func2(init);
}
|
by: Bryan Parkoff |
last post by:
The local variables and local functions are inside class body. You
define a variable to the class "Reg reg;" in the main function. The reg
variable has a pointer. The pointer gives memory...
|
by: mdh |
last post by:
Hi all,
When I try and initialize this static array, as in:
void itoa_recursively(int n, char *s){
static char *p = s;
it fails, yet this:
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
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,...
|
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...
|
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...
|
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,...
| |