comp.lang.c++
  Home FAQ Contact Sign in
comp.lang.c++ only
 
Advanced search
December 2007
motuwethfrsasuw
     12 48
3456789 49
10111213141516 50
17181920212223 51
24252627282930 52
31       1
2007
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007 2006  
total
comp.lang.c++ Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  Template -- Diamond ring Problem         


Author: Pallav singh
Date: Dec 26, 2007 23:55

I am Facing Problem while creating object of Diamond Ring problem
solving using Template
Kindly let me known where i am committing ERROR

Thanks
Pallav

#include
#include

template
class A
{
private :
T a;

public :
A(T a1):a(a1){}
A(const A& a){}

~A(){}

void Get_Value()const
{cout<<"Value of a :: "<< a <
};
Show full article (1.43Kb)
6 Comments
  Challenging GotW 66's moral         


Author: George2
Date: Dec 26, 2007 22:54

Hello everyone,

In GotW #66, one of the moral is the exception handler of constructor
should not do any like resource free task. I do not agree. Here is the
quoated moral and my code to prove this moral will have memory leak.

Anything wrong with my analysis?

http://www.gotw.ca/gotw/066.htm

Moral #1: Constructor function-try-block handlers have only one
purpose -- to translate an exception. (And maybe to do logging or some
other side effects.) They are not useful for any other purpose.

[Code]
class A
{
private:

int* p;

public:

A()
try
{
p = new int[10];
Show full article (1.01Kb)
4 Comments
  member functions returning class type         


Author: eastern_strider
Date: Dec 26, 2007 17:49

Hi,

In the following code snippet, if I comment out line b, the output
becomes:

constructor
constructor

whereas if I comment out line c, the output becomes:

constructor
copy constructor

Any explanations regarding what is causing this difference is
appreciated.

#include
using namespace std;

class A {
public:
A() { cout << "constructor" << endl; }
A(const A& obj) { cout << "copy constructor" << endl; }
A foo() { return A(); }
};
Show full article (0.58Kb)
7 Comments
  Configuration hierarchy organization         


Author: Kenneth Porter
Date: Dec 26, 2007 17:14

I'm trying to organize the XML for my system configuration.

I have a System (top-level object) comprising a varying number of
Components, each with its own configuration. I also have a number of
classes representing stateful bundles of related methods. The latter
classes need per-component configuration. Should that configuration be
grouped with each Component's configuration, or should it be stored with
the configuration for each bundle of stateful methods? What are the pros
and cons of each?

Here's a "picture" of the runtime organization:

class System
{
Container components;
StatefulMethodBundle1 group1;
StatefulMethodBundle2 group2;
};

What are the relative advantages of storing a parameter in these ways?

System.component[x].group1.y

versus

System.group1.component[x].y
Show full article (0.92Kb)
6 Comments
  Coding for Windows and Linux         


Author: Alex
Date: Dec 26, 2007 14:58

Hi,

About 5 months ago I changed professions and moved from being a web
programmer (ColdFusion mainly) to a Visual Basic.Net app coder, and
though this is my first time to do application coding in a decade or
more, I'm loving it! It's also my first time to really use OOP, which
I'm slowly but surely getting the hang of.

Though I've started coding in VB during the day, my home systems are
all Linux. If I wanted to start developing apps for both Linux and
Windows, I assume C++ is the best choice. So a number of questions
related to this:

1) I assume code can not be copied verbatim between GCC and VC++, but
just how compatible are they?
2) For GCC under Linux I know I'll need a graphical toolkit/framework
like tkl/tk or QT, but do these port to Windows?
3) Are there any open source apps anyone can direct me to that do
this? I'd love to peak under the hood.

Thanks
--

Alex
5 Comments
  swap char array.         


Author: NK
Date: Dec 26, 2007 10:33

char *a="nnnnnnn fgjfjgjf";
char *b="ABC jjjjjjjjjhhhh";

to swap these two string......
this swap fn is working

template
void Swap( const T *&a,const T *&b)//no need to write const
{
T *temp;
temp=a;

a=b;

b=temp;

}

but to swap

char a[]="nhfhdhfhh fgjfjgjf";
char b[]="ABC jjjjjjjjjhhhh";
Show full article (0.53Kb)
3 Comments
  ===Welcome to comp.lang.c++! Read this first.         


Author: Shiva
Date: Dec 26, 2007 09:29

Welcome to comp.lang.c++! Read this first.

This post is intended to give the new reader an introduction to reading
and posting in this newsgroup. We respectfully request that you read
all the way through this post, as it helps make for a more pleasant
and useful group for everyone.

First of all, please keep in mind that comp.lang.c++ is a group for discussion
of general issues of the C++ programming language, as defined by the ANSI/ISO
language standard. If you have a problem that is specific to a particular system
or compiler, you are much more likely to get complete and accurate answers in a
group that specializes in your platform. A listing of some newsgroups is given
at the end of this post.

The FAQ (Frequently Asked Question) list has a wealth of information for
both the new and veteran C++ programmer. No matter what your experience
level, you are encouraged to read the entire list, if only to familiarize
yourself with what answers are available to minimize redundant replies.
The comp.lang.c++ FAQ is available at http://www.parashift.com/c++-faq-lite/

If the FAQ list does not help, then many regular readers of this group
are happy to assist with problems of standard C++. We have only a few
requests that we ask be adhered to, for the benefit of all:
Show full article (4.94Kb)
no comments
  Namespaces         


Author: Nikos Hatzigiannakis
Date: Dec 26, 2007 08:42

I cannot understand why the following code does not work. The compiler
displays the error
'x' undeclared (first use this function) in the sentance after the usung
namespace second; statement.
any help will be appreciated .

#include
using namespace std;

namespace first
{
int x = 5;
int y = 10;
}

namespace second
{
double x = 3.1416;
double y = 2.7183;
}
Show full article (0.57Kb)
7 Comments
  Placement new for Arrays : How does VC++ handle it ?         


Author: sparc
Date: Dec 26, 2007 08:06

Hi Guys,

I am encountering the following issue :

void* pMemory = m_Allocator.allocate( uiSize * sizeof( T ) );
m_atData = new( pMemory ) T[m_uiSize];

Debug.vc8.scurc.exe!`eh vector constructor iterator'(void *
ptr=0x00514b9c, unsigned int size=12, int count=12, void (void *)*
pCtor=0x00414537, void (void *)* pDtor=0x00414523) + 0x5e bytes C++

Do I need to code my own construct_n( ) ? I am ok with it but I just
want to know why there is an offset between m_atData and pMemory.

Technically I believe the m_atData should point to the same location
as pMemory after placement new is done. However this is turning out to
be false. The address of m_atData is addressof pMemory + 4. Iam
puzzled as this does not happen all the time. For some classes it
works fine and for others it dont.

I might be naive on this although I have tried debugging most of the
trivial stuff. Could someone please help ?

Thanks in advance
Venkatesh.SC
6 Comments
  Problem with dev-c++         


Author: camelot
Date: Dec 26, 2007 07:14

Hi,
I hope not to be OT. Please, in this case address me rightly...
I'm using Dev-c++ 4.9.9.2. under XP. When I compile the cpp for the
first time the exe file works fine. If I try to modify the source cpp
and compile it again, it append that the exe is not accessible by the
compiler (or linker, ld.exe) and if I try to open manually the exe
file, the file is not accessible (I do not have permission and stuff
like that..).
Do you have idea on why it happen?

Regards,
Camelot
3 Comments
1 2 3