473,703 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

static & dynamic allocation problem

Hi,
I have little confusion about static memory allocation & dynamic
allocation for a cluss member.

I have class like
class Bar{
public:
explicit Bar(){
cout<<"bar default"<<endl;
}
explicit Bar(int x){
cout<<"bar int "<<x<<endl;
}
~Bar(){
cout<<"bar dtor"<<endl;
}
};
class Foo{
private:
Bar bar;
public:
explicit Foo(){
cout<<"foo default"<<endl;
}
explicit Foo(int x) : bar(Bar(10)){
cout<<"foo int "<<x<<endl;
}
~Foo(){
//delete bar;
cout<<"foo dtor"<<endl;
}
};

alternative way to write class Foo as,

class Foo{
private:
Bar* bar;
public:
explicit Foo() : bar(new Bar()){
cout<<"foo default"<<endl;
}
explicit Foo(int x) : bar(new Bar(10)){
cout<<"foo int "<<x<<endl;
}
~Foo(){
delete bar;
cout<<"foo dtor"<<endl;
}
};

which Foo class is to be used when? Most of the GUI library (like
wxWindows and Qt) I find the second kind is used (.i.e dynamic
allocation).
Note, in this case the bar objects lifetime is same as Foo's, i.e its
created at Foo constructor & destroyed at Foo's destructor. I know that
if Bar to be initializd any other place that Foo's ctor & destroyed
other than Foo's dtor, the second method is the only way. But if that
is not the case, which one is preferred? any problem wth the virtual
function of Bar for the first implementation?
moreover,
if I initialize,
Foo foo = Foo(4);
for the first sizeof(foo) is 1, while for second it is 4. why is so?
Also how the memory layout is different between first and second case?

thanks in advance

abir

Aug 4 '06 #1
11 3045

toton 写道:
Hi,
I have little confusion about static memory allocation & dynamic
allocation for a cluss member.

I have class like
class Bar{
public:
explicit Bar(){
cout<<"bar default"<<endl;
}
explicit Bar(int x){
cout<<"bar int "<<x<<endl;
}
~Bar(){
cout<<"bar dtor"<<endl;
}
};
class Foo{
private:
Bar bar;
public:
explicit Foo(){
cout<<"foo default"<<endl;
}
explicit Foo(int x) : bar(Bar(10)){
cout<<"foo int "<<x<<endl;
}
~Foo(){
//delete bar;
cout<<"foo dtor"<<endl;
}
};

alternative way to write class Foo as,

class Foo{
private:
Bar* bar;
public:
explicit Foo() : bar(new Bar()){
cout<<"foo default"<<endl;
}
explicit Foo(int x) : bar(new Bar(10)){
cout<<"foo int "<<x<<endl;
}
~Foo(){
delete bar;
cout<<"foo dtor"<<endl;
}
};

which Foo class is to be used when? Most of the GUI library (like
wxWindows and Qt) I find the second kind is used (.i.e dynamic
allocation).
Note, in this case the bar objects lifetime is same as Foo's, i.e its
created at Foo constructor & destroyed at Foo's destructor. I know that
if Bar to be initializd any other place that Foo's ctor & destroyed
other than Foo's dtor, the second method is the only way. But if that
is not the case, which one is preferred? any problem wth the virtual
function of Bar for the first implementation?
moreover,
if I initialize,
Foo foo = Foo(4);
for the first sizeof(foo) is 1, while for second it is 4. why is so?
Also how the memory layout is different between first and second case?

thanks in advance

abir
You can try:
class temp
{
public:
temp(void) {}
~temp(void) {}
};

sizeof(temp) = 1;

class temp1
{
public:
temp1(void) {}
~temp1(void) {}
private:
temp t;
};

sizeof(temp1) = 1;

class temp2
{
public:
temp2(void) {}
~temp2(void) {}
private:
temp *t;
};

sizeof(temp2) = 4;

Aug 4 '06 #2
"if I initialize,
Foo foo = Foo(4);
for the first sizeof(foo) is 1, while for second it is 4. why is so? "

The first sizeof(foo) == 1, because for some reason, when c++ compile
meet a class with no member variable, means sizeof(myClass) == 0, it
will fake something into myClass, to make it larger than 0. That is,
You will never get a sizeof(myClass) == 0. I think I have read this
from C++ Primier.

The next sizeof(foo) is actually the size of Bar*.
toton wrote:
Hi,
I have little confusion about static memory allocation & dynamic
allocation for a cluss member.

I have class like
class Bar{
public:
explicit Bar(){
cout<<"bar default"<<endl;
}
explicit Bar(int x){
cout<<"bar int "<<x<<endl;
}
~Bar(){
cout<<"bar dtor"<<endl;
}
};
Aug 4 '06 #3

we*****@gmail.c om wrote:
toton 写道:
Hi,
I have little confusion about static memory allocation & dynamic
allocation for a cluss member.

I have class like
class Bar{
public:
explicit Bar(){
cout<<"bar default"<<endl;
}
explicit Bar(int x){
cout<<"bar int "<<x<<endl;
}
~Bar(){
cout<<"bar dtor"<<endl;
}
};
class Foo{
private:
Bar bar;
public:
explicit Foo(){
cout<<"foo default"<<endl;
}
explicit Foo(int x) : bar(Bar(10)){
cout<<"foo int "<<x<<endl;
}
~Foo(){
//delete bar;
cout<<"foo dtor"<<endl;
}
};

alternative way to write class Foo as,

class Foo{
private:
Bar* bar;
public:
explicit Foo() : bar(new Bar()){
cout<<"foo default"<<endl;
}
explicit Foo(int x) : bar(new Bar(10)){
cout<<"foo int "<<x<<endl;
}
~Foo(){
delete bar;
cout<<"foo dtor"<<endl;
}
};

which Foo class is to be used when? Most of the GUI library (like
wxWindows and Qt) I find the second kind is used (.i.e dynamic
allocation).
Note, in this case the bar objects lifetime is same as Foo's, i.e its
created at Foo constructor & destroyed at Foo's destructor. I know that
if Bar to be initializd any other place that Foo's ctor & destroyed
other than Foo's dtor, the second method is the only way. But if that
is not the case, which one is preferred? any problem wth the virtual
function of Bar for the first implementation?
moreover,
if I initialize,
Foo foo = Foo(4);
for the first sizeof(foo) is 1, while for second it is 4. why is so?
Also how the memory layout is different between first and second case?

thanks in advance

abir

You can try:
class temp
{
public:
temp(void) {}
~temp(void) {}
};

sizeof(temp) = 1;

class temp1
{
public:
temp1(void) {}
~temp1(void) {}
private:
temp t;
};

sizeof(temp1) = 1;

class temp2
{
public:
temp2(void) {}
~temp2(void) {}
private:
temp *t;
};

sizeof(temp2) = 4;
I understand why sizeof(temp2) is 4. 4 byte is the pointer size for 32
bit platform. What I don't understand is why sizeof(temp1) is 1. It
should be zero! Is it just to follow the spec that sizeof(char) is
always 1 and minimum size for anything?

More than that, my question is when to use which style, ie. when to use
Bar* bar, and when Bar bar as a class member variable. and what are the
consequences for virtual function and memory allocation.

thanks

Aug 4 '06 #4
See this book <<Inside the C++ Object Model >>.
toton wrote:
we*****@gmail.c om wrote:
toton 写道:
Hi,
I have little confusion about static memory allocation & dynamic
allocation for a cluss member.
>
I have class like
class Bar{
public:
explicit Bar(){
cout<<"bar default"<<endl;
}
explicit Bar(int x){
cout<<"bar int "<<x<<endl;
}
~Bar(){
cout<<"bar dtor"<<endl;
}
};
>
>
class Foo{
private:
Bar bar;
public:
explicit Foo(){
cout<<"foo default"<<endl;
}
explicit Foo(int x) : bar(Bar(10)){
cout<<"foo int "<<x<<endl;
}
~Foo(){
//delete bar;
cout<<"foo dtor"<<endl;
}
};
>
alternative way to write class Foo as,
>
class Foo{
private:
Bar* bar;
public:
explicit Foo() : bar(new Bar()){
cout<<"foo default"<<endl;
}
explicit Foo(int x) : bar(new Bar(10)){
cout<<"foo int "<<x<<endl;
}
~Foo(){
delete bar;
cout<<"foo dtor"<<endl;
}
};
>
which Foo class is to be used when? Most of the GUI library (like
wxWindows and Qt) I find the second kind is used (.i.e dynamic
allocation).
Note, in this case the bar objects lifetime is same as Foo's, i.e its
created at Foo constructor & destroyed at Foo's destructor. I know that
if Bar to be initializd any other place that Foo's ctor & destroyed
other than Foo's dtor, the second method is the only way. But if that
is not the case, which one is preferred? any problem wth the virtual
function of Bar for the first implementation?
moreover,
if I initialize,
Foo foo = Foo(4);
for the first sizeof(foo) is 1, while for second it is 4. why is so?
Also how the memory layout is different between first and second case?
>
thanks in advance
>
abir
You can try:
class temp
{
public:
temp(void) {}
~temp(void) {}
};

sizeof(temp) = 1;

class temp1
{
public:
temp1(void) {}
~temp1(void) {}
private:
temp t;
};

sizeof(temp1) = 1;

class temp2
{
public:
temp2(void) {}
~temp2(void) {}
private:
temp *t;
};

sizeof(temp2) = 4;
I understand why sizeof(temp2) is 4. 4 byte is the pointer size for 32
bit platform. What I don't understand is why sizeof(temp1) is 1. It
should be zero! Is it just to follow the spec that sizeof(char) is
always 1 and minimum size for anything?

More than that, my question is when to use which style, ie. when to use
Bar* bar, and when Bar bar as a class member variable. and what are the
consequences for virtual function and memory allocation.

thanks
Aug 4 '06 #5
On 2006-08-04 05:34:47 -0400, "toton" <ab*******@gmai l.comsaid:
>
we*****@gmail.c om wrote:
>toton 写道:
>>Hi,
I have little confusion about static memory allocation & dynamic
allocation for a cluss member.

I have class like
class Bar{
public:
explicit Bar(){
cout<<"bar default"<<endl;
}
explicit Bar(int x){
cout<<"bar int "<<x<<endl;
}
~Bar(){
cout<<"bar dtor"<<endl;
}
};
class Foo{
private:
Bar bar;
public:
explicit Foo(){
cout<<"foo default"<<endl;
}
explicit Foo(int x) : bar(Bar(10)){
cout<<"foo int "<<x<<endl;
}
~Foo(){
//delete bar;
cout<<"foo dtor"<<endl;
}
};

alternative way to write class Foo as,

class Foo{
private:
Bar* bar;
public:
explicit Foo() : bar(new Bar()){
cout<<"foo default"<<endl;
}
explicit Foo(int x) : bar(new Bar(10)){
cout<<"foo int "<<x<<endl;
}
~Foo(){
delete bar;
cout<<"foo dtor"<<endl;
}
};

which Foo class is to be used when? Most of the GUI library (like
wxWindows and Qt) I find the second kind is used (.i.e dynamic
allocation) .
Note, in this case the bar objects lifetime is same as Foo's, i.e its
created at Foo constructor & destroyed at Foo's destructor. I know that
if Bar to be initializd any other place that Foo's ctor & destroyed
other than Foo's dtor, the second method is the only way. But if that
is not the case, which one is preferred? any problem wth the virtual
function of Bar for the first implementation?
moreover,
if I initialize,
Foo foo = Foo(4);
for the first sizeof(foo) is 1, while for second it is 4. why is so?
Also how the memory layout is different between first and second case?

thanks in advance

abir

You can try:
class temp
{
public:
temp(void) {}
~temp(void) {}
};

sizeof(temp) = 1;

class temp1
{
public:
temp1(void) {}
~temp1(void) {}
private:
temp t;
};

sizeof(temp1 ) = 1;

class temp2
{
public:
temp2(void) {}
~temp2(void) {}
private:
temp *t;
};

sizeof(temp2 ) = 4;
I understand why sizeof(temp2) is 4. 4 byte is the pointer size for 32
bit platform. What I don't understand is why sizeof(temp1) is 1. It
should be zero! Is it just to follow the spec that sizeof(char) is
always 1 and minimum size for anything?

Imagine you had an array of temp1:

temp1 array[10];

If sizeof(temp1) were 0, then many things would break down. For
instance, all elements of the array would have the same exact address.
Since every object of the same type must have a unique address, this
situation must be prevented; hence, every complete type must have a
size of at least 1.
--
Clark S. Cox, III
cl*******@gmail .com

Aug 4 '06 #6
toton wrote:
I have little confusion about static memory allocation & dynamic
allocation for a cluss member.

I have class like
class Bar{
public:
explicit Bar(){
cout<<"bar default"<<endl;
}
explicit Bar(int x){
cout<<"bar int "<<x<<endl;
}
~Bar(){
cout<<"bar dtor"<<endl;
}
};
class Foo{
private:
Bar bar;
public:
explicit Foo(){
cout<<"foo default"<<endl;
}
explicit Foo(int x) : bar(Bar(10)){
cout<<"foo int "<<x<<endl;
}
~Foo(){
//delete bar;
cout<<"foo dtor"<<endl;
}
};

alternative way to write class Foo as,

class Foo{
private:
Bar* bar;
public:
explicit Foo() : bar(new Bar()){
cout<<"foo default"<<endl;
}
explicit Foo(int x) : bar(new Bar(10)){
cout<<"foo int "<<x<<endl;
}
~Foo(){
delete bar;
cout<<"foo dtor"<<endl;
}
};

which Foo class is to be used when? Most of the GUI library (like
wxWindows and Qt) I find the second kind is used (.i.e dynamic
allocation).
Note, in this case the bar objects lifetime is same as Foo's, i.e its
created at Foo constructor & destroyed at Foo's destructor. I know that
if Bar to be initializd any other place that Foo's ctor & destroyed
other than Foo's dtor, the second method is the only way. But if that
is not the case, which one is preferred?
Either could be useful depending on the situation, though in the second
case I'd suggest using a smart pointer/container that gives exception
safety (cf.
http://www.parashift.com/c++-faq-lit....html#faq-17.2) and
automatic cleanup instead of explicit news and deletes (cf.
http://www.parashift.com/c++-faq-lit...html#faq-34.1).

In general, you should use explicit dynamic allocation only when you
have to (e.g., with polymorphic objects, with objects intialized
outside the constructor, etc.), but sometimes using a pointer can
reduce compile-time dependencies and speed up build times. See
http://www.gotw.ca/publications/mill04.htm.
any problem wth the virtual
function of Bar for the first implementation?
There is no virtual function in your Bar class above, but there would
be no inherent problem if there were (but cf.
http://www.parashift.com/c++-faq-lit....html#faq-20.7)
unless you were expecting to use Bar as a polymorphic object. For that
you'd need a pointer or reference.
moreover,
if I initialize,
Foo foo = Foo(4);
for the first sizeof(foo) is 1, while for second it is 4. why is so?
This has been covered in the other responses.
Also how the memory layout is different between first and second case?
The compiler has some flexibility with memory layout and classes with
private data (it could add padding or move things around a bit, and if
you add a virtual function as it seems you meant to do, other things
can change), so it's impossible to say in general. Thus, you should not
depend on the low-level layout of your classes in the usual case.
However, we can of course say that the first case has an instance of
class Bar as part of its memory footprint, whereas the second only has
a pointer to a Bar as part of its footprint.

Cheers! --M

Aug 4 '06 #7
Is********@gmai l.com wrote:
See this book <<Inside the C++ Object Model >>.
See below.

Brian

--
Please don't top-post. Your replies belong following or interspersed
with properly trimmed quotes. See the majority of other posts in the
newsgroup, or the group FAQ list:
<http://www.parashift.c om/c++-faq-lite/how-to-post.htm>
Aug 4 '06 #8

mlimber wrote:
toton wrote:
I have little confusion about static memory allocation & dynamic
allocation for a cluss member.

I have class like
class Bar{
public:
explicit Bar(){
cout<<"bar default"<<endl;
}
explicit Bar(int x){
cout<<"bar int "<<x<<endl;
}
~Bar(){
cout<<"bar dtor"<<endl;
}
};
class Foo{
private:
Bar bar;
public:
explicit Foo(){
cout<<"foo default"<<endl;
}
explicit Foo(int x) : bar(Bar(10)){
cout<<"foo int "<<x<<endl;
}
~Foo(){
//delete bar;
cout<<"foo dtor"<<endl;
}
};

alternative way to write class Foo as,

class Foo{
private:
Bar* bar;
public:
explicit Foo() : bar(new Bar()){
cout<<"foo default"<<endl;
}
explicit Foo(int x) : bar(new Bar(10)){
cout<<"foo int "<<x<<endl;
}
~Foo(){
delete bar;
cout<<"foo dtor"<<endl;
}
};

which Foo class is to be used when? Most of the GUI library (like
wxWindows and Qt) I find the second kind is used (.i.e dynamic
allocation).
Note, in this case the bar objects lifetime is same as Foo's, i.e its
created at Foo constructor & destroyed at Foo's destructor. I know that
if Bar to be initializd any other place that Foo's ctor & destroyed
other than Foo's dtor, the second method is the only way. But if that
is not the case, which one is preferred?

Either could be useful depending on the situation, though in the second
case I'd suggest using a smart pointer/container that gives exception
safety (cf.
http://www.parashift.com/c++-faq-lit....html#faq-17.2) and
automatic cleanup instead of explicit news and deletes (cf.
http://www.parashift.com/c++-faq-lit...html#faq-34.1).

In general, you should use explicit dynamic allocation only when you
have to (e.g., with polymorphic objects, with objects intialized
outside the constructor, etc.), but sometimes using a pointer can
reduce compile-time dependencies and speed up build times. See
http://www.gotw.ca/publications/mill04.htm.
any problem wth the virtual
function of Bar for the first implementation?

There is no virtual function in your Bar class above, but there would
be no inherent problem if there were (but cf.
http://www.parashift.com/c++-faq-lit....html#faq-20.7)
unless you were expecting to use Bar as a polymorphic object. For that
you'd need a pointer or reference.
moreover,
if I initialize,
Foo foo = Foo(4);
for the first sizeof(foo) is 1, while for second it is 4. why is so?

This has been covered in the other responses.
Also how the memory layout is different between first and second case?

The compiler has some flexibility with memory layout and classes with
private data (it could add padding or move things around a bit, and if
you add a virtual function as it seems you meant to do, other things
can change), so it's impossible to say in general. Thus, you should not
depend on the low-level layout of your classes in the usual case.
However, we can of course say that the first case has an instance of
class Bar as part of its memory footprint, whereas the second only has
a pointer to a Bar as part of its footprint.
Thanks for the reply.
Thus can I safely assume that using heap allocation (may be with
auto_ptr ) will not have n any performance problem?
In fact I am using container classes for arrays, but again there are
two types of allocation can be done.
like vector<MyClassa nd vector<MyClass* >
I have flexibility and easeness for second type ( I never forget to
delete memory, also I use all the boost pointers whichone suitable :) )
Only thing, most of the time people say stack based alocation is much
much faster than heap mased one. I am not sure how much true it is, but
like heap based as it offers flexibility, as I can initialize the
object when I need and the way I want.
But what I feel, for container class stack based initialization causes
all of the classes to reside nearby memory, which is not so for heap
based classes.
And syntactically one needs one more line of code if wants to use
overloaded operators for heap based classes (minor problem to me).
Something I have noticed like a few books only gives an good intro to
heap based allocation, people rarely put pointer to class inside a STL
container, and I rarely get a code which initialized a template class
on heap.
On the otherhand, nearly all of the GUI frameworks (MFC is mixed) ,
most of networking framework, graphics framework etc use heap based
allocation always.
Even I came across some GUI framework like Ultimate++ which uses stack
memory for the GUI components, while most other (like Qt VCF wxWidgets
VCL etc) uses heap allocation. even some of the framework reserve
struct for stack bases & class for heap based allocation (artificially,
I know there is no restriction from language).
I am basically interested in some sort of performance comparison for
it. And in turn some sort of guideline, when to use which one.
Cheers! --M
Aug 5 '06 #9

toton skrev:
mlimber wrote:
toton wrote:
I have little confusion about static memory allocation & dynamic
allocation for a cluss member.
>
I have class like
[snip example with member as pointer or as variable]
which Foo class is to be used when? Most of the GUI library (like
wxWindows and Qt) I find the second kind is used (.i.e dynamic
allocation).
Note, in this case the bar objects lifetime is same as Foo's, i.e its
created at Foo constructor & destroyed at Foo's destructor. I know that
if Bar to be initializd any other place that Foo's ctor & destroyed
other than Foo's dtor, the second method is the only way. But if that
is not the case, which one is preferred?
Either could be useful depending on the situation, though in the second
case I'd suggest using a smart pointer/container that gives exception
safety (cf.
http://www.parashift.com/c++-faq-lit....html#faq-17.2) and
automatic cleanup instead of explicit news and deletes (cf.
http://www.parashift.com/c++-faq-lit...html#faq-34.1).

In general, you should use explicit dynamic allocation only when you
have to (e.g., with polymorphic objects, with objects intialized
outside the constructor, etc.), but sometimes using a pointer can
reduce compile-time dependencies and speed up build times. See
http://www.gotw.ca/publications/mill04.htm.
[snip]
Thanks for the reply.
Thus can I safely assume that using heap allocation (may be with
auto_ptr ) will not have n any performance problem?
No you can not. Follow mlimbers advice and avoid pointers unless you
have to. Using new and delete will invariably incur a cost in memory as
well as cpu-time. If it turns up to be a performance problem, i cant
tell - it depends on lots of things.
But more importantly, using pointers require far more code and is not
completely trivial to implement (Your original code was buggy).
In fact I am using container classes for arrays, but again there are
two types of allocation can be done.
like vector<MyClassa nd vector<MyClass* >
I have flexibility and easeness for second type ( I never forget to
delete memory, also I use all the boost pointers whichone suitable :) )
Again, use the simplest method available and refactor if it turns out
to be insufficient.
Only thing, most of the time people say stack based alocation is much
much faster than heap mased one. I am not sure how much true it is
It is accurate. A stack allocation is practically a free lunch in the
environments I work in (Windows/Unix). This is not true for a heap
allocation.
>, but
like heap based as it offers flexibility, as I can initialize the
object when I need and the way I want.
[snip]

/Peter

Aug 5 '06 #10

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

Similar topics

6
3288
by: J Anderson | last post by:
Greetings, I was going through the quake2 source code (as you do) when I noticed arrays are statically allocated on the stack instead of being allocated dynamically. Ive seen this before and know its for efficiency. Im basically questioning the merit of such technique nowadays, for performance-orientated applications? Is it better to dynamically allocate a smaller array to fit the memory or to use one huge statically allocated...
24
2759
by: Steven T. Hatton | last post by:
In the following code, at what point is S::c fully defined? #include <iostream> using std::cout; using std::endl; using std::ostream; class C { int _v;
115
7612
by: Mark Shelor | last post by:
I've encountered a troublesome inconsistency in the C-language Perl extension I've written for CPAN (Digest::SHA). The problem involves the use of a static array within a performance-critical transform function. When compiling under gcc on my big-endian PowerPC (Mac OS X), declaring this array as "static" DECREASES the transform throughput by around 5%. However, declaring it as "static" on gcc/Linux/Intel INCREASES the throughput by...
24
19080
by: Ken | last post by:
In C programming, I want to know in what situations we should use static memory allocation instead of dynamic memory allocation. My understanding is that static memory allocation like using array is faster than malloc, but dynamic memory allocation is more flexible. Please comment... thanks.
7
8220
by: Jo | last post by:
Hi, How can i differentiate between static and dynamic allocated objects? For example: void SomeFunction1() { CObject *objectp = new CObject; CObject object;
6
3560
by: Marvin Barley | last post by:
I have a class that throws exceptions in new initializer, and a static array of objects of this type. When something is wrong in initialization, CGI program crashes miserably. Debugging shows uncaught exception. How to catch an exception that happened before main() try { ... } catch (...) { ... } block? Is there a way?
3
2991
by: ranjeetasharma81 | last post by:
Hi all, I have a big C-cod, in which there are lots of dynamic memory allocation used. I want to replace dynamic memroy allocation by static arrays. The following are the problems that i am facing: 1- From structure and dynamic memory allocation point of view, the code is very complicated. The code has various nested structures with a number of levels. The size of memory allocated for pointer to structure or its pointer...
30
2457
by: Alf P. Steinbach | last post by:
I once suggested in that SomeOne Else(TM) should propose a string value class that accepted literals and char pointers and so on, with possible custom deleter, and in case of literal strings just carrying the original pointer. In other words, for the simplest usage code: * no overhead (just carrying a pointer or two), and * no possibility of exceptions (for that case).
10
4422
by: swornavidhya.mahadevan | last post by:
Which allocation (Static / Dynamic) is suitable for the situation when we are trying to allocate for a overloaded memory when the memory is full and no space to allocate. What will happen if both the allocation is impossible. Sworna vidhya
0
8758
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, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9251
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
9121
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
6588
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
5922
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
4432
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...
1
3123
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
2450
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2069
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.