- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: aCC A.03.52 behaving in an unexpected way with...
Operating System - Linux
1753792
Members
7573
Online
108799
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2006 10:23 PM
10-30-2006 10:23 PM
aCC 3.52 behaving in an unexpected way with opeator keyword
Hi,
I'm having an issue with the following code:
#include
class A;
class B {
public:
B(A &a) {
print("B::B(...)\n");
}
};
class A {
public:
B begin() {
printf("B::Begin\n");
return(B(*this));
}
operator B () {
printf("cast\n");
return(begin());
}
};
int main() {
A a;
a.begin()
return(0);
}
I would expect this code to output something similar to:
B::begin
B::B(...)
then quite, however it seems that the aCC compiler is calling the operator B () hence going into an infinite loop causing a stack overflow. Changing the A::begin method to the following code makes the program operate as expected:
B begin() {
printf("B::Begin\n");
B b(*this);
return(b);
}
is there some kind of compiler switch or similar that would allow me to get the expected behaviour from the first code example (which compiles and runs as expected using gcc under linux)?
I'm having an issue with the following code:
#include
class A;
class B {
public:
B(A &a) {
print("B::B(...)\n");
}
};
class A {
public:
B begin() {
printf("B::Begin\n");
return(B(*this));
}
operator B () {
printf("cast\n");
return(begin());
}
};
int main() {
A a;
a.begin()
return(0);
}
I would expect this code to output something similar to:
B::begin
B::B(...)
then quite, however it seems that the aCC compiler is calling the operator B () hence going into an infinite loop causing a stack overflow. Changing the A::begin method to the following code makes the program operate as expected:
B begin() {
printf("B::Begin\n");
B b(*this);
return(b);
}
is there some kind of compiler switch or similar that would allow me to get the expected behaviour from the first code example (which compiles and runs as expected using gcc under linux)?
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2006 04:47 PM - edited 10-23-2011 06:25 PM
10-31-2006 04:47 PM - edited 10-23-2011 06:25 PM
Re: aCC A.03.52 behaving in an unexpected way with operator keyword
This works fine with aCC6. To get it to work with aCC3, you'll have to remove that user conversion function. Or rewrite the code with the temp as you said.
- Tags:
- overloading
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP