Click here to Skip to main content
15,919,358 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Are there some problems in the following source? Pin
Joaquín M López Muñoz24-Feb-02 22:06
Joaquín M López Muñoz24-Feb-02 22:06 
GeneralRe: Are there some problems in the following source? Pin
Feng Qin24-Feb-02 23:28
Feng Qin24-Feb-02 23:28 
GeneralRe: Are there some problems in the following source? Pin
Paul M Watt24-Feb-02 23:40
mentorPaul M Watt24-Feb-02 23:40 
GeneralRe: Are there some problems in the following source? Pin
Joaquín M López Muñoz24-Feb-02 23:40
Joaquín M López Muñoz24-Feb-02 23:40 
GeneralRe: Are there some problems in the following source? Pin
Michael Dunn25-Feb-02 7:55
sitebuilderMichael Dunn25-Feb-02 7:55 
GeneralRe: Are there some problems in the following source? Pin
Joaquín M López Muñoz25-Feb-02 8:01
Joaquín M López Muñoz25-Feb-02 8:01 
GeneralRe: Are there some problems in the following source? Pin
Michael Dunn25-Feb-02 10:13
sitebuilderMichael Dunn25-Feb-02 10:13 
GeneralRe: Are there some problems in the following source? Pin
Joaquín M López Muñoz25-Feb-02 10:29
Joaquín M López Muñoz25-Feb-02 10:29 
I did! Try the following (please bare with typos, I'm writing this without IDE support):
class A
{
  public:
    A(const char *)
    {
    }
  private:
    A(const A&);
};
 
int main()
{
  A a="hello";
  return 0;
}
Under default settings, whis will compile fine and actually only A::A(const char*) is being invoked. However, if you set the /Za flag (disable MS proprietary extensions to C++), then an error pops up complaining that the copy ctor is not accessible and thus, by the rules of C++, optimizing it away is not legal. This is called elided copy constructor, and there's a paragraph in the standard dealing with the issue. Also Stroustrup in The C++ Programming Language, Special Edition states the sequence of calls for an expression of a form analogous to this in an example. If you're interested I could try to locate the exact paragraph for you.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
GeneralRe: Are there some problems in the following source? Pin
Michael Dunn25-Feb-02 7:52
sitebuilderMichael Dunn25-Feb-02 7:52 
GeneralRe: Are there some problems in the following source? Pin
Joaquín M López Muñoz25-Feb-02 7:53
Joaquín M López Muñoz25-Feb-02 7:53 
QuestionWhat message should my app handle when user shutdown/logoff the system Pin
24-Feb-02 18:51
suss24-Feb-02 18:51 
AnswerRe: What message should my app handle when user shutdown/logoff the system Pin
Paul M Watt24-Feb-02 18:58
mentorPaul M Watt24-Feb-02 18:58 
GeneralRe: What message should my app handle when user shutdown/logoff the system Pin
24-Feb-02 19:04
suss24-Feb-02 19:04 
GeneralRe: What message should my app handle when user shutdown/logoff the system Pin
Paul M Watt24-Feb-02 19:17
mentorPaul M Watt24-Feb-02 19:17 
GeneralRe: Thanx Pin
24-Feb-02 21:10
suss24-Feb-02 21:10 
GeneralNetwork logins Pin
Coremn24-Feb-02 17:09
Coremn24-Feb-02 17:09 
GeneralRe: Network logins Pin
Jon Hulatt24-Feb-02 22:08
Jon Hulatt24-Feb-02 22:08 
GeneralSTL/for_each/templated function question Pin
Christian Graus24-Feb-02 17:06
protectorChristian Graus24-Feb-02 17:06 
GeneralRe: STL/for_each/templated function question Pin
Paul M Watt24-Feb-02 17:17
mentorPaul M Watt24-Feb-02 17:17 
GeneralRe: STL/for_each/templated function question Pin
Christian Graus24-Feb-02 17:25
protectorChristian Graus24-Feb-02 17:25 
GeneralRe: STL/for_each/templated function question Pin
Paul M Watt24-Feb-02 17:37
mentorPaul M Watt24-Feb-02 17:37 
GeneralRe: STL/for_each/templated function question Pin
Joaquín M López Muñoz24-Feb-02 20:03
Joaquín M López Muñoz24-Feb-02 20:03 
QuestionSTL from MS oder SGI? Pin
Travis D. Mathison24-Feb-02 15:46
Travis D. Mathison24-Feb-02 15:46 
AnswerRe: STL from MS oder SGI? Pin
Paul M Watt24-Feb-02 15:55
mentorPaul M Watt24-Feb-02 15:55 
GeneralRe: STL from MS oder SGI? Pin
Travis D. Mathison24-Feb-02 16:06
Travis D. Mathison24-Feb-02 16:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.