Jump to content

Nytro

Administrators
  • Posts

    18715
  • Joined

  • Last visited

  • Days Won

    701

Everything posted by Nytro

  1. FBI Arrests Suspected LulzSec and Anonymous Hackers By Jana Winter Published September 22, 2011| FoxNews.com he FBI arrested two alleged members of the hacking collectives LulzSec and Anonymous on Thursday morning in San Francisco and Phoenix and secured charges against a third suspect from Ohio, the Justice Department confirmed Thursday. Search warrants were also being executed in New Jersey, Minnesota and Montana, an FBI official told FoxNews.com, which first reported the arrests. One individual was described as part of the LulzSec group, the other part of the group that calls itself Anonymous, the official said. Cody Kretsinger, a 23-year-old from Phoenix, was charged with conspiracy and the unauthorized impairment of a protected computer, according to the federal indictment unsealed Thursday morning. In another indictment, Christopher Doyon, 47, of Mountain View, Calif., and Joshua Covelli, 26, of Fairborn, Ohio, were charged with conspiracy to cause intentional damage to a protected computer, causing intentional damage to a protected computer and aiding and abetting. The indictment says both men participated in a "distributed denial of service" attack on Santa Cruz County, Calif.'s computer servers in 2010, causing them to go offline. It alleges that the attack was carried out by the People's Liberation Front, which is associated with hacking groups such as Anonymous. Kretsinger, who goes by the online name "recursion," is believed to be a current or former member of LulzSec and is accused of being involved in the hacking of Sony Pictures Entertainment. Kretsinger and other coconspirators are accused of using a hacking technique called a SQL injection to obtain confidential information from Sony's computer systems. According to the indictment, he and coconspirators distributed stolen information by posting it on LulzSec's website before announcing the attack on Twitter. In order to evade law-enforcement detection, Kretsinger erased the hard drives used to carry out the Sony attack, the indictment said. He is expected to appear in a Phoenix federal court Thursday afternoon. Members of the Los Angeles FBI field office also arrested an alleged member of Anonymous in San Francisco. The suspected hacker is homeless and alleged to have been involved in Santa Cruz County government website cyberattacks, an FBI official told FoxNews.com exclusively. That suspect appears to have been Doyon, though this couldn't be immediately confirmed Thursday night. LulzSec is a splinter group from the “hacktivist” collective Anonymous, a loose collection of cybersavvy activists inspired by WikiLeaks and its head Julian Assange to fight for Internet freedoms — along the way defacing websites, shutting down servers, and scrawling messages across screens web-wide. While Anonymous is largely a politically motivated organization, LulzSec’s attacks were largely done “for the lulz” — Internet slang meaning “for the fun of it.” Both groups have been targeted by the FBI and international law enforcement agencies in recent months. In July, FoxNews.com broke the news that 16 alleged Anonymous members had been arrested in the U.S. and the U.K. Several high profile leaders of the group have been arrested since, including two individuals believed to be among the founders of LulzSec — and who shared the online name "Kayla." The metropolitan police in London arrested the first alleged member of the LulzSec group on June 20, a 19-year-old teen named Ryan Cleary. Subsequent sweeps through Italy and Switzerland in early July led to the arrests of 15 more people, all between the ages of 15 and 28. The two groups are responsible for a broad spate of digital break-ins targeting governments and large corporations, including Japanese technology giant Sony, the U.S. Senate, telecommunications giant AT&T, Fox.com, and other government and private entities. Sursa: FBI Arrests Suspected LulzSec And Anonymous Hackers | Fox News
  2. Da, pretul ar trebui sa depinda de complexitatea site-urilor.
  3. E de incredere.
  4. Daca v-ar sfatui cineva sa bateti un luptator de K1, sa va bateti cu Kilmbo Slice sau vreun mascat, oameni cu pregatire de ani de zile si voi niste cacaciosi, ce ati face? Si aici ma refer la toti cu "te duci si ii bati pe cei 7 mai mari cu 4 ani decat tine si probabil mai bine facuti".
  5. C++ FAQs (Second Edition) Authors: - Marshall Cline - Greg Lomow - Mike Girou Data: May 2000 Contents I Preliminaries 1 1 Introduction 3 1.1 What is the purpose of this chapter? . . . . . . . . . . . . . . . . 3 1.2 What are C++ FAQs? . . . . . . . . . . . . . . . . . . . . . . . . 3 1.3 Who is the target audience for this book? . . . . . . . . . . . . . 3 1.4 Is this a book about C++ per se? . . . . . . . . . . . . . . . . . 4 1.5 Why do developers need a guidebook for C++ and OO technology? 4 1.6 What kind of guidance is given in the answers to these FAQs? . . 5 1.7 What is the electronic FAQ and why buy this book when the electronic FAQ is free? . . . . . . . . . . . . . . . . . . . . . . . . 5 1.8 Why should you buy this edition if you already have a copy of the first edition? . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.9 What conventions are used in this book? . . . . . . . . . . . . . . 6 2 Basic C++ Syntax and Semantics 9 2.1 What is the purpose of this chapter? . . . . . . . . . . . . . . . . 9 2.2 What are the basics of main()? . . . . . . . . . . . . . . . . . . . 9 2.3 What are the basics of functions? . . . . . . . . . . . . . . . . . . 10 2.4 What are the basics of default parameters? . . . . . . . . . . . . 10 2.5 What are the basics of local (auto) objects? . . . . . . . . . . . . 11 2.6 What are the basics of constructing objects using explicit parameters? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.7 What are the basics of dynamically allocated (new) objects? . . . 13 2.8 What are the basics of local objects within inner scopes? . . . . . 14 2.9 What are the basics of passing objects by reference? . . . . . . . 15 2.10 What are the basics of passing objects by value? . . . . . . . . . 16 2.11 What are the basics of passing objects by pointer? . . . . . . . . 17 2.12 What are the basics of stream output? . . . . . . . . . . . . . . . 18 2.13 What are the basics of stream input? . . . . . . . . . . . . . . . . 19 2.14 What are the basics of using classes that contain overloaded operators? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 2.15 What are the basics of using container classes? . . . . . . . . . . 21 2.16 What are the basics of creating class header files? . . . . . . . . . 22 2.17 What are the basics of defining a class? . . . . . . . . . . . . . . 23 2.18 What are the basics of defining member functions? . . . . . . . . 24 2.19 What are the basics of adding a constructor to a class? . . . . . . 25 2.20 What are the basics of adding a destructor to a class? . . . . . . 27 ii 2.21 What are the basics of defining a class that contains a pointer to an object allocated from the heap? . . . . . . . . . . . . . . . . . 28 2.22 What are the basics of global objects? . . . . . . . . . . . . . . . 30 2.23 What are the basics of throwing and catching exceptions? . . . . 32 2.24 What are the basics of inheritance and dynamic binding? . . . . 34 3 Understanding the Management Perspective 37 3.1 What is the purpose of this chapter? . . . . . . . . . . . . . . . . 37 3.2 What is the core message of this chapter (and this book)? . . . . 37 3.3 Why are the managers in charge rather than the developers who understand technology? . . . . . . . . . . . . . . . . . . . . . . . 38 3.4 How can someone manager something they don’t understand? . . 39 3.5 What is the most common mistake on C++ and OO projects? . 39 3.6 What’s the “Software Peter Principle”? . . . . . . . . . . . . . . 40 3.7 Should an organization use OO on all its projects? . . . . . . . . 40 3.8 Can OO be ignored until it goes away? . . . . . . . . . . . . . . . 41 3.9 What OO language is best? . . . . . . . . . . . . . . . . . . . . . 41 3.10 What is the right approach to processes and tools? . . . . . . . . 42 3.11 What is the right approach with off-the-shelf class libraries and frameworks? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 4 The Architectural Perspective 44 4.1 What is the purpose of this chapter? . . . . . . . . . . . . . . . . 44 4.2 Why is software architecture important? . . . . . . . . . . . . . . 44 4.3 What should the architecture be based on, the problem being solved or the problem domain? . . . . . . . . . . . . . . . . . . . 45 4.4 Should the software architecture be based on the policy of the problem? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 4.5 Do customers ever change their requirements? . . . . . . . . . . . 47 4.6 Are stable requirements desirable? . . . . . . . . . . . . . . . . . 47 4.7 What is the key to planning for change? . . . . . . . . . . . . . . 47 4.8 What is a framework? . . . . . . . . . . . . . . . . . . . . . . . . 48 4.9 What is the “inversion of control” exhibited by frameworks? . . . 48 4.10 What is an extensible, domain-specific framework? . . . . . . . . 49 4.11 What characteristics make a framework extensible yet domainspecific? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 4.12 What happens if the domain analysis is incorrect? . . . . . . . . 50 4.13 How much effort should be expended to support change — that is, how much is extensibility worth? . . . . . . . . . . . . . . . . 50 4.14 How does an architect make the software architecture flexible? . 51 4.15 What is the secret to achieving reuse? . . . . . . . . . . . . . . . 52 II Object-Oriented Design 53 5 Object-Oriented Fundamentals 55 5.1 What is the purpose of this chapter? . . . . . . . . . . . . . . . . 55 5.2 Why is the world adopting OO technology? . . . . . . . . . . . . 55 5.3 What are some of the benefits of using C++ for OO programming? 56 5.4 What are the fundamental concepts of object-oriented technology? 56 iii 5.5 Why are classes important? . . . . . . . . . . . . . . . . . . . . . 57 5.6 What is an object? . . . . . . . . . . . . . . . . . . . . . . . . . . 58 5.7 What are the desirable qualities of an object? . . . . . . . . . . . 58 5.8 How are classes better than the three basic building blocks of procedural software? . . . . . . . . . . . . . . . . . . . . . . . . . 59 5.9 What is the purpose of composition? . . . . . . . . . . . . . . . . 60 5.10 What is the purpose of inheritance? . . . . . . . . . . . . . . . . 61 5.11 What are the advantages of polymorphism and dynamic binding? 61 5.12 How does OO help produce flexible and extensible software? . . . 62 5.13 How can old code call new code? . . . . . . . . . . . . . . . . . . 62 5.14 What is an abstraction and why is it important? . . . . . . . . . 65 5.15 Should abstractions be user-centric or developer-centric? . . . . . 66 5.16 What’s the difference between encapsulation and abstraction? . . 66 5.17 What are the consequences of encapsulating a bad abstraction? . 67 5.18 What’s the value of separating interface from implementation? . 67 5.19 How can separating interface from implementation improve performance as well as flexibility? . . . . . . . . . . . . . . . . . . . 68 5.20 What is the best way to create a good interface to an abstraction? 69 5.21 How are get/set member functions related to poorly designed interfaces? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 5.22 Should there be a get and a set member function for each member datum? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 5.23 Is the real purpose of a class to export data? . . . . . . . . . . . 71 5.24 Should OO be viewed as data-centric? . . . . . . . . . . . . . . . 71 6 Specification of Observable Behavior 73 6.1 What is the purpose of this chapter? . . . . . . . . . . . . . . . . 73 6.2 Should users of a member function rely on what the code actually does or on the specification? . . . . . . . . . . . . . . . . . . . . . 73 6.3 What are the advantages of relying on the specification rather than the implementation? . . . . . . . . . . . . . . . . . . . . . . 75 6.4 What are advertised requirements and advertised promises? . . . 76 6.5 How are the advertised requirements and advertised promises of the member functions specified? . . . . . . . . . . . . . . . . . . . 76 6.6 Why are changes feared in development organizations that don’t use specification? . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 6.7 How do developers determine if a proposed change will break existing code? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 6.8 What are the properties of a substitutable (backward compatible) change in a specification? . . . . . . . . . . . . . . . . . . . . . . 79 6.9 How can it be shown that the implementation of a member function fulfills its specification? . . . . . . . . . . . . . . . . . . . . . 80 6.10 Is it possible to keep the specification synchronized with the code? 81 7 Proper Inheritance 83 7.1 What is proper inheritance? . . . . . . . . . . . . . . . . . . . . . 83 7.2 What are the benefits of proper inheritance? . . . . . . . . . . . 84 7.3 What is improper inheritance? . . . . . . . . . . . . . . . . . . . 85 7.4 Isn’t the difference between proper and improper inheritance obvious? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 iv 7.5 Is substitutability based on what the code does or what the specification promises the code will do? . . . . . . . . . . . . . . . . . 86 7.6 Is it proper to revoke (hide) an inherited public: member function? 88 7.7 What is specialization? . . . . . . . . . . . . . . . . . . . . . . . . 88 7.8 What do subsets have to do with proper inheritance? . . . . . . . 89 8 Detecting and Correcting Improper Inheritance 90 8.1 Can improper inheritance wreck a project? . . . . . . . . . . . . 90 8.2 What’s the best way to learn how to avoid improper inheritance? 90 8.3 Is intuition a reliable guide to understanding proper inheritance? 91 8.4 Is an Ostrich a kind-of Bird? . . . . . . . . . . . . . . . . . . . 91 8.5 Should an overridden virtual function throw an exception? . . . . 93 8.6 Can an overridden virtual function be a no-op? . . . . . . . . . . 95 8.7 Why does C++ make it so hard to fix the Ostrich/Bird dilemma? 96 8.8 Should Circle inherit from Ellipse? . . . . . . . . . . . . . . . 97 8.9 What can be done about the asymmetric-circle dilemma? . . . . 99 8.10 What is the one issue in these FAQs that doesn’t seem to die? . 100 8.11 Should Stack inherit from List? . . . . . . . . . . . . . . . . . . 101 8.12 Is code reuse the main purpose of inheritance? . . . . . . . . . . 102 8.13 Is container-of-thing a kind-of container-of-anything? . . . . . . . 103 8.14 Is bag-of-apple a kind-of bag-of-fruit, assuming bag-of-fruit allows the insertion of any kind-of fruit? . . . . . . . . . . . . . . . . . . 104 8.15 Is parking-lot-for-cars a kind-of parking-lot-for-arbitrary-vehicles (assuming parking-lot-for-vehicles allows parking any kind-of vehicle? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 8.16 Is array-of Derived a kind-of Base? . . . . . . . . . . . . . . . . 108 8.17 Does the fact that an array-of Derived can be passed as an arrayof Base mean that arrays are bad? . . . . . . . . . . . . . . . . . 110 9 Error Handling Strategies 111 9.1 Is error handling a major source of fundamental mistakes? . . . . 111 9.2 How should runtime errors be handled in C++? . . . . . . . . . 111 9.3 What happens to objects in stack frames that become unwound during the throw/catch process? . . . . . . . . . . . . . . . . . . 112 9.4 What is an exception specification? . . . . . . . . . . . . . . . . . 112 9.5 What are the disadvantages of using return codes for error handling? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 9.6 What are the advantages of throw...catch? . . . . . . . . . . . 113 9.7 Why is it helpful to separate normal logic from exception handling logic? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 9.8 What is the hardest part of using exception handling? . . . . . . 117 9.9 When should a function throw an exception? . . . . . . . . . . . 118 9.10 What is the best approach for the hierarchy of exception objects? 120 9.11 How should exception classes be named? . . . . . . . . . . . . . . 121 9.12 Where do setjmp and longjmp belong in C++? . . . . . . . . . 122 10 Testing Strategies 123 10.1 What is the purpose of this chapter? . . . . . . . . . . . . . . . . 123 10.2 What are the advantages of self-testing objects? . . . . . . . . . . 123 v 10.3 What are some common excuses people use for not building selftesting into their objects? . . . . . . . . . . . . . . . . . . . . . . 124 10.4 What will happen if techniques like those presented here are not used? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 10.5 When is a class correct? . . . . . . . . . . . . . . . . . . . . . . . 125 10.6 What is behavioral self-testing? . . . . . . . . . . . . . . . . . . . 126 10.7 What is a class invariant? . . . . . . . . . . . . . . . . . . . . . . 128 10.8 Why should the invariant be captured explicitly? . . . . . . . . . 129 10.9 When should the testInvariant() member function be called? 130 10.10What can be done to ensure that an object doesn’t get blown away by a wild pointer? . . . . . . . . . . . . . . . . . . . . . . . 130 III Language Facilities 133 11 References 135 11.1 What is a reference? . . . . . . . . . . . . . . . . . . . . . . . . . 135 11.2 What does “referent” mean? . . . . . . . . . . . . . . . . . . . . 136 11.3 When can a reference be attached to its referent? . . . . . . . . . 136 11.4 What happens when a value is assigned to a reference? . . . . . . 136 11.5 What is a local reference? . . . . . . . . . . . . . . . . . . . . . . 137 11.6 What does it mean to return a reference? . . . . . . . . . . . . . 137 11.7 What is the result of taking the address of a reference? . . . . . . 138 11.8 Can a reference be made to refer to a different referent? . . . . . 139 11.9 Why use references when pointers can do everything references can do? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 11.10Aren’t references just pointers in disguise? . . . . . . . . . . . . . 140 11.11When are pointers needed? . . . . . . . . . . . . . . . . . . . . . 140 11.12Why do some people hate references? . . . . . . . . . . . . . . . . 141 11.13Does int& const x make sense? . . . . . . . . . . . . . . . . . . 141 12 New and Delete 143 12.1 Does new do more than allocate memory? . . . . . . . . . . . . . 143 12.2 Why is new better than good old trustworthy malloc()? . . . . . 143 12.3 Does C++ have a counterpart to realloc() that goes along with new and delete? . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 12.4 Can pointers returned from new be deallocated with free()? Can pointers returned from malloc() be deallocated with delete? . 144 12.5 Does delete p delete the pointer p or the referent *p? . . . . . . 144 12.6 Should the pointer returned from new Fred() be checked to see if it is NULL? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 12.7 How can new be convinced to return NULL rather than throw an exception? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 12.8 How can new be set up to automatically flush pools of recycled objects whenever memory runs low? . . . . . . . . . . . . . . . . 146 12.9 What happens if delete p is called when p is NULL? . . . . . . . 149 12.10What happens when a pointer is deleted twice? . . . . . . . . . . 150 12.11How can an array of things be allocated and deallocated? . . . . 150 12.12What if delete p (not delete[] p) is used to delete an array allocated via new Fred[n]? . . . . . . . . . . . . . . . . . . . . . 151 vi 12.13Can the [] of delete[] p be dropped when p points to an array of some built-in type such as char? . . . . . . . . . . . . . . . . . 151 12.14How is an object constructed at a predetermined position in memory? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 12.15How can class Fred guarantee that Fred objects are created only with new and not on the stack? . . . . . . . . . . . . . . . . . . . 153 12.16How are objects created by placement new destroyed? . . . . . . 154 12.17In p = new Fred(), does the Fred memory “leak” if the Fred constructor throws an exception? . . . . . . . . . . . . . . . . . . 155 12.18Is it legal (and moral) for a member function to say delete this?156 12.19After p=new Fred[n], how does the compiler know that there are n objects to be destructed during delete[] p? . . . . . . . . . . 157 13 Inline Functions 158 13.1 What is the purpose of inline functions? . . . . . . . . . . . . . 158 13.2 What is the connection between the keyword “inline” and “inlined” functions? . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 13.3 Are there any special rules about inlining? . . . . . . . . . . . . . 159 13.4 What is the one-definition rule (ODR)? . . . . . . . . . . . . . . 159 13.5 What are some performance considerations with inline functions?160 13.6 Do inlined functions improve performance? . . . . . . . . . . . . 160 13.7 Do inlined functions increase the size of the executable code? . . 162 13.8 Why shouldn’t the inlining decision be made when the code is first written? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 13.9 What happens when a programmer uses an inlined function obtained from a third party? . . . . . . . . . . . . . . . . . . . . . . 163 13.10Is there an easy way to swap between inline and non-inline code? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 14 Const Correctness 167 14.1 How should pointer declarations be read? . . . . . . . . . . . . . 167 14.2 How can C++ programmers avoid making unexpected changes to objects? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 14.3 Does const imply runtime overhead? . . . . . . . . . . . . . . . . 169 14.4 Does const allow the compiler to generate more efficient code? . 169 14.5 Is const correctness tedious? . . . . . . . . . . . . . . . . . . . . 169 14.6 Why should const correctness be done sooner rather than later? 170 14.7 What’s the difference between an inspector and a mutator? . . . 171 14.8 When should a member function be declared as const? . . . . . 171 14.9 Does const apply to the object’s bitwise state or its abstract state?172 14.10When should const not be used in declaring formal parameters? 173 14.11When should const not be used in declaring a function return type? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 14.12How can a “nonobservable” data member be updated within a const member function? . . . . . . . . . . . . . . . . . . . . . . . 175 14.13Can an object legally be changed even though there is a const reference (pointer) to it? . . . . . . . . . . . . . . . . . . . . . . . 176 14.14Does const cast mean lost optimization opportunities? . . . . . 177 vii 15 Namespaces 178 15.1 What is the purpose of this chapter? . . . . . . . . . . . . . . . . 178 15.2 What is a namespace? . . . . . . . . . . . . . . . . . . . . . . . . 178 15.3 How can code outside a namespace use names declared within that namespace? . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 15.4 What happens if two namespaces contain the same name? . . . . 180 15.5 What are some of the rules for using namespaces? . . . . . . . . 181 15.6 What is name lookup? . . . . . . . . . . . . . . . . . . . . . . . . 182 15.7 What are the tradeoffs between the various techniques for using names from a namespace, particularly the standard namespace? . 182 15.8 Can namespaces break code? . . . . . . . . . . . . . . . . . . . . 183 15.9 Do namespaces have any other applications? . . . . . . . . . . . . 184 15.10How do namespaces solve the problem of long identifiers? . . . . 184 16 Using Static 185 16.1 What is the purpose of this chapter? . . . . . . . . . . . . . . . . 185 16.2 What are static class members? . . . . . . . . . . . . . . . . . . . 185 16.3 What is an analogy for static data members? . . . . . . . . . . . 186 16.4 Can inline functions safely access static data members? . . . . 188 16.5 What is an analogy for static member functions? . . . . . . . . . 189 16.6 How is a static data member similar to a global variable? . . . . 191 16.7 How is a static member function similar to a friend function? . . 192 16.8 What is the named constructor idiom? . . . . . . . . . . . . . . . 192 16.9 How should static member functions be called? . . . . . . . . . . 193 16.10Why might a class with static data members get linker errors? . 194 16.11How is a const static data member initialized? . . . . . . . . . . 194 16.12What is the right strategy for implementing a function that needs to maintain state between calls? . . . . . . . . . . . . . . . . . . 195 16.13How can the function call operator help with functionoids? . . . 197 16.14Is it safe to be ignorant of the static initialization order problem? 198 16.15What is a simple and robust solution to the static initialization order problem? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 16.16What if the static object’s destructor has important side effects that must eventually occur? . . . . . . . . . . . . . . . . . . . . . 200 16.17What if the static object’s destructor has important side effects that must eventually occur and the static object must be accessed by another static object’s destructor? . . . . . . . . . . . . . . . . 201 16.18What are some criteria for choosing between all these various techniques? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 17 Derived Classes 205 17.1 What is the purpose of this chapter? . . . . . . . . . . . . . . . . 205 17.2 How does C++ express inheritance? . . . . . . . . . . . . . . . . 205 17.3 What is a concrete derived class? . . . . . . . . . . . . . . . . . . 206 17.4 Why can’t a derived class access the private: members of its base class? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 17.5 How can a base class protect derived classes so that changes to the base class will not affect them? . . . . . . . . . . . . . . . . . 209 17.6 Can a derived class pointer be converted into a pointer to its public base class? . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 viii 17.7 How can a class Y be a kind-of another class X as well as getting the bits of X? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 17.8 How can a class Y get the bits of an existing class X without making Y a kind-of X? . . . . . . . . . . . . . . . . . . . . . . . . 211 17.9 How can a class Y be a kind-of another class X without inheriting the bits of X? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 18 Access Control 213 18.1 What is the purpose of this chapter? . . . . . . . . . . . . . . . . 213 18.2 How are private:, protected:, and public: different? . . . . . 213 18.3 Why can’t subclasses access the private: parts of their base class?213 18.4 What’s the difference between the keywords struct and class? 214 18.5 When should a data member be protected: rather than private:?214 18.6 Why is private: the default access level for a class? . . . . . . . 215 19 Friend Classes and Friend Functions 216 19.1 What is a friend? . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 19.2 What’s a good mental model for friend classes? . . . . . . . . . . 217 19.3 What are some advantages of using friend classes? . . . . . . . . 218 19.4 Do friends violate the encapsulation barrier? . . . . . . . . . . . 218 19.5 What is a friend function? . . . . . . . . . . . . . . . . . . . . . . 218 19.6 When should a function be implemented as a friend function rather than a member function? . . . . . . . . . . . . . . . . . . . 219 19.7 What are some guidelines to make sure friend functions are used properly? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 19.8 What does it mean that friendship isn’t transitive? . . . . . . . . 220 19.9 What does it mean that friendship isn’t inherited? . . . . . . . . 222 19.10What does it mean that friends aren’t virtual? . . . . . . . . . . 223 19.11What qualities suggest a friend function rather than a member function? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 19.12Should friend functions be declared in the private:, protected:, or public: section of a class? . . . . . . . . . . . . . . . . . . . . 227 19.13What is a private class? . . . . . . . . . . . . . . . . . . . . . . . 227 19.14How are objects of a class printed? . . . . . . . . . . . . . . . . . 229 19.15How do objects of a class receive stream input? . . . . . . . . . . 230 20 Constructors and Destructors 231 20.1 What is the purpose of a constructor? . . . . . . . . . . . . . . . 231 20.2 What is C++’s constructor discipline? . . . . . . . . . . . . . . . 231 20.3 What is the purpose of a destructor? . . . . . . . . . . . . . . . . 231 20.4 What is C++’s destructor discipline? . . . . . . . . . . . . . . . . 231 20.5 What happens when a destructor is executed? . . . . . . . . . . . 231 20.6 What is the purpose of a copy constructor? . . . . . . . . . . . . 231 20.7 When is a copy constructor invoked? . . . . . . . . . . . . . . . . 231 20.8 What is the “default constructor”? . . . . . . . . . . . . . . . . . 232 20.9 Should one constructor call another constructor as a primitive? . 232 20.10Does the destructor for a derived class need to explicitly call the destructor of its base class? . . . . . . . . . . . . . . . . . . . . . 232 20.11How can a local object be destructed before the end of its function?232 ix 20.12What is a good way to provide intuitive, multiple constructors for a class? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 20.13When the constructor of a base class calls a virtual function, why isn’t the override called? . . . . . . . . . . . . . . . . . . . . . . . 232 20.14When a base class destructor calls a virtual function, why isn’t the override called? . . . . . . . . . . . . . . . . . . . . . . . . . . 232 20.15What is the purpose of placement new? . . . . . . . . . . . . . . 232 21 Virtual Functions 233 21.1 What is the purpose of this chapter? . . . . . . . . . . . . . . . . 233 21.2 What is a virtual member function? . . . . . . . . . . . . . . . . 233 21.3 How much does it cost to call a virtual function compared to calling a normal functions? . . . . . . . . . . . . . . . . . . . . . 233 21.4 How does C++ perform static typing while supporting dynamic binding? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 21.5 Can destructors be virtual? . . . . . . . . . . . . . . . . . . . . . 233 21.6 What is the purpose of a virtual destructor? . . . . . . . . . . . . 233 21.7 What is a virtual constructor? . . . . . . . . . . . . . . . . . . . 234 21.8 What syntax should be used when a constructor or destructor calls a virtual function in its project? . . . . . . . . . . . . . . . . 234 21.9 Should the scope operator :: be used when invoking virtual member functions? . . . . . . . . . . . . . . . . . . . . . . . . . . 234 21.10What is a pure virtual member function? . . . . . . . . . . . . . 234 21.11Can a pure virtual function be defined in the same class that declares it? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 21.12How should a virtual destructor be defined when it has no code? 234 21.13Can an ABC have a pure virtual destructor? . . . . . . . . . . . 234 21.14How can the compiler be kept from generating duplicate out-lined copies of inline virtual functions? . . . . . . . . . . . . . . . . . . 234 21.15Should a class with virtual functions have at least one non-inline virtual function? . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 22 Initialization Lists 236 22.1 What are constructor initialization lists? . . . . . . . . . . . . . . 236 22.2 What will happen if constructor initialization lists are not used? 236 22.3 What’s the guideline for using initialization lists in constructor definitions? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 22.4 Is it normal for constructors to have nothing inside their body? . 236 22.5 How is a const data member initialized? . . . . . . . . . . . . . . 236 22.6 How is a reference data member initialized? . . . . . . . . . . . . 236 22.7 Are initializers executed in the same order in which they appear in the initialization list? . . . . . . . . . . . . . . . . . . . . . . . 237 22.8 How should initializers be ordered in a constructor’s initialization list? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 22.9 Is it normal for one member object to be initialized using another member object in the constructor’s initialization list? . . . . . . . 237 22.10What if one member object has to be initialized using another member object? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 22.11Are there exceptions to the rule “Initialize all member objects in an initialization list”? . . . . . . . . . . . . . . . . . . . . . . . . 237 x 22.12How can an array of objects be initialized with specific initializers?237 23 Operator Overloading 238 23.1 Are overloaded operators like normal functions? . . . . . . . . . . 238 23.2 When should operator overloading be used? . . . . . . . . . . . . 238 23.3 What operators can’t be overloaded? . . . . . . . . . . . . . . . . 238 23.4 Is the goal of operator overloading to make the class easier to understand? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 23.5 Why do subscript operators usually come in pairs? . . . . . . . . 238 23.6 What is the most important consideration for operators such as +=, +, and =? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 23.7 How are the prefix and postfix versions of operator++ distinguished? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 23.8 What should the prefix and postfix versions of operator++ return?239 23.9 How can a Matrix-like class have a subscript operator that takes more than one subscript? . . . . . . . . . . . . . . . . . . . . . . 239 23.10Can a ** operator serve as an exponentiation operator? . . . . . 239 24 Assignment Operators 240 24.1 What should assignment operators return? . . . . . . . . . . . . 240 24.2 What is wrong with an object being assigned to itself? . . . . . . 240 24.3 What should be done about self-assignment? . . . . . . . . . . . 240 24.4 Should an assignment operator throw an exception after partially assigning an object? . . . . . . . . . . . . . . . . . . . . . . . . . 240 24.5 How should the assignment operator be declared in an ABC? . . 240 24.6 When should a user-defined assignment operator mimic the assignment operator that the compiler would generate automatically?240 24.7 What should be returned by private: and protected: assignment operators? . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 24.8 Are there techniques that increase the likelihood that the compilersynthesized assignment operator will be right? . . . . . . . . . . . 241 24.9 How should the assignment operator in a derived class behave? . 241 24.10Can an ABC’s assignment operator be virtual? . . . . . . . . . 241 24.11What should a derived class do if a base class’s assignment operator is virtual? . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 24.12Should the assignment operator be implemented by using placement new and the copy constructor? . . . . . . . . . . . . . . . . 241 25 Templates 242 25.1 What is the purpose of templates? . . . . . . . . . . . . . . . . . 242 25.2 What are the syntax and semantics for a class template? . . . . . 242 25.3 How can a template class be specialized to handle special cases? 244 25.4 What are the syntax and semantics for a function template? . . . 247 25.5 Should a template use memcpy() to copy objects of its template argument? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 25.6 Why does the compiler complain about >> when one template is used inside another? . . . . . . . . . . . . . . . . . . . . . . . . . 249 xi 26 Exception Tactics 251 26.1 What belongs in a try block? . . . . . . . . . . . . . . . . . . . . 251 26.2 When should a function catch an exception? . . . . . . . . . . . 251 26.3 Should a catch block fully recover from an error? . . . . . . . . . 252 26.4 How should a constructor handle a failure? . . . . . . . . . . . . 254 26.5 What are zombie objects (and why should they be avoided)? . . 254 26.6 What should an object do if one of its member objects could throw an exception during its constructor? . . . . . . . . . . . . . 255 26.7 Should destructors throw exceptions when they fail? . . . . . . . 257 26.8 Should destructors call routines that may throw exception? . . . 257 26.9 Should resource deallocation primitives signal failure by throwing an exception? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 26.10What should the terminate() function do? . . . . . . . . . . . . 258 26.11What should the unexpected() function do? . . . . . . . . . . . 259 26.12Under what circumstances can an overridden virtual member function throw exceptions other than those listed by the specification of the member function in the base class? . . . . . . . . 261 26.13How might the exception-handling mechanism cause a program to silently crash? . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 27 Types and RTTI 264 27.1 What is the purpose of this chapter? . . . . . . . . . . . . . . . . 264 27.2 What is static type checking? . . . . . . . . . . . . . . . . . . . . 264 27.3 What is dynamic type checking? . . . . . . . . . . . . . . . . . . 265 27.4 What is the basic problem with dynamic type checking? . . . . . 267 27.5 How can dynamic type checking be avoided? . . . . . . . . . . . 267 27.6 Are there better alternatives to dynamic type checking? . . . . . 268 27.7 What is a capability query? . . . . . . . . . . . . . . . . . . . . . 269 27.8 What is an alternative to dynamic type checking with containers? 269 27.9 Are there cases where dynamic type checking is necessary? . . . 270 27.10Given a pointer to an ABC, how can the class of the referent be found? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 27.11What is a downcast? . . . . . . . . . . . . . . . . . . . . . . . . . 273 27.12What is an alternative to using downcasts? . . . . . . . . . . . . 274 27.13Why are downcasts dangerous? . . . . . . . . . . . . . . . . . . . 276 27.14Should the inheritance graph of C++ hierarchies be tall or short? 276 27.15Should the inheritance graph of C++ hierarchies be monolithic or a forest? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 27.16What is Runtime Type Identification (RTTI)? . . . . . . . . . . 277 27.17What is the purpose of dynamic cast<T>()? . . . . . . . . . . . 277 27.18Is dynamic cast<T>() a panacea? . . . . . . . . . . . . . . . . . 278 27.19What does static cast<T>() do? . . . . . . . . . . . . . . . . . 279 27.20What does typeid() do? . . . . . . . . . . . . . . . . . . . . . . 279 27.21Are there any hidden costs for type-safe downcasts? . . . . . . . 279 28 Containers 281 28.1 What are container classes and what are the most common mistakes made with container classes? . . . . . . . . . . . . . . . . . 281 28.2 Are arrays good or evil? . . . . . . . . . . . . . . . . . . . . . . . 282 xii 28.3 Should application development organizations create their own container classes? . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 28.4 What are some common mistakes with containers of pointers? . . 283 28.5 Does this mean that containers of pointers should be avoided? . . 283 28.6 Surely good old-fashioned char* is an exception, right? . . . . . 283 28.7 Can auto ptr<T> simplify ownership problems with containers of pointers? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 28.8 Can a Java-like Object class simplify containers in C++? . . . . 284 28.9 What’s the difference between a homogeneous and a heterogeneous container? . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 28.10Is it a good idea to use a “best of breed” approach when selecting container classes? . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 28.11Should all projects use C++’s standardized containers? . . . . . 286 28.12What are the C++ standardized container classes? . . . . . . . . 286 28.13What are the best applications for the standardized C++ sequence container classes? . . . . . . . . . . . . . . . . . . . . . . 287 28.14What are the best situations for the standardized C++ associative container classes? . . . . . . . . . . . . . . . . . . . . . . . . 290 IV Topics 292 29 Mixing Overloading with Inheritance 294 29.1 What is the difference between overloaded functions and overridden functions? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 29.2 What is the hiding rule? . . . . . . . . . . . . . . . . . . . . . . . 295 29.3 How should the hiding rule be handled? . . . . . . . . . . . . . . 298 29.4 What should a derived class do when it redefines some but not all of a set of overloaded member functions inherited from the base class? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 29.5 Can virtual functions be overloaded? . . . . . . . . . . . . . . . . 301 30 The Big Three 304 30.1 What is the purpose of this chapter? . . . . . . . . . . . . . . . . 304 30.2 What are the Big Three? . . . . . . . . . . . . . . . . . . . . . . 304 30.3 What happens when an object is destroyed that doesn’t have an explicit destructor? . . . . . . . . . . . . . . . . . . . . . . . . . . 305 30.4 What happens if an object is copied but doesn’t have an explicit copy constructor? . . . . . . . . . . . . . . . . . . . . . . . . . . . 306 30.5 What happens when an object that doesn’t have an explicit assignment operator is assigned? . . . . . . . . . . . . . . . . . . . 307 30.6 What is the Law of the Big Three? . . . . . . . . . . . . . . . . . 308 30.7 Which of the Big Three usually shows up first? . . . . . . . . . . 308 30.8 What is remote ownership? . . . . . . . . . . . . . . . . . . . . . 309 30.9 How is remote ownership special? . . . . . . . . . . . . . . . . . . 310 30.10What if a class owns a referent and doesn’t have all of the Big Three? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 30.11Are there any C++ classes that help manage remote ownership? 312 30.12Does auto ptr enforce the Law of the Big Three and solve the problems associated with remote ownership? . . . . . . . . . . . . 314 xiii 30.13Are there cases where one or two of the Big Three may be needed but not all three? . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 30.14Are there any other circumstances that might explicitly warrant the Big Three? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 30.15Why does copying an object using memcpy() cause a program crash? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 30.16Why do programs with variable-length argument lists crash? . . 318 30.17Why do programs that use realloc() to reallocate an array of objects crash? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 31 Using Objects to Prevent Memory Leaks 321 31.1 When are memory leaks important? . . . . . . . . . . . . . . . . 321 31.2 What is the easiest way to avoid memory leaks? . . . . . . . . . . 321 31.3 What are the most important principles for resource management?324 31.4 Should the object that manages a resource also perform operations that may throw exceptions? . . . . . . . . . . . . . . . . . . 325 31.5 Should an object manage two or more resources? . . . . . . . . . 326 31.6 What if an object has a pointer to an allocation and one of the object’s member functions deletes the allocation? . . . . . . . . 327 31.7 How should a pointer variable be handled after being passed to delete? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328 31.8 What should be done with a pointer to an object that is allocated and deallocated in the same scope? . . . . . . . . . . . . . . . . . 328 31.9 How easy is it to implement reference counting with pointer semantics? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 31.10Is reference counting with copy-on-write semantics hard to implement? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 31.11How can reference counting be implemented with copy-on-write semantics for a hierarchy of classes? . . . . . . . . . . . . . . . . 333 32 Wild Pointers and Other Devilish Errors 337 32.1 What is a wild pointer? . . . . . . . . . . . . . . . . . . . . . . . 337 32.2 What happens to a program that has even one wild pointer? . . 337 32.3 What does the compiler mean by the warning “Returning a reference to a local object”? . . . . . . . . . . . . . . . . . . . . . . 338 32.4 How should pointers across block boundaries be controlled? . . . 338 32.5 Is the reference-versus-pointer issue influenced by whether or not the object is allocated from the heap? . . . . . . . . . . . . . . . 339 32.6 When should C-style pointer casts be used? . . . . . . . . . . . . 340 32.7 Is it safe to bind a reference variable to a temporary object? . . . 341 32.8 Should a parameter passed by const reference be returned by const reference? . . . . . . . . . . . . . . . . . . . . . . . . . . . 341 32.9 Should template functions for things like min(x,y) or abs(x) return a const reference? . . . . . . . . . . . . . . . . . . . . . . 342 32.10When is zero not necessarily zero? . . . . . . . . . . . . . . . . . 342 33 High-Performance Software 345 33.1 Is bad performance a result of bad design or bad coding? . . . . 345 33.2 What are some techniques for improving performance? . . . . . . 346 33.3 What is an advantage of using pointers and references? . . . . . . 347 xiv 33.4 What is a disadvantage of lots of references and pointers? . . . . 349 33.5 How else can member objects improve performance over pointers? 351 33.6 Which is better, ++i or i++? . . . . . . . . . . . . . . . . . . . . 351 33.7 What is the performance difference between Fred x(5); and Fred y = 5; and Fred z = Fred(5);? . . . . . . . . . . . . . . 353 33.8 What kinds of applications should consider using final classes and final member functions? . . . . . . . . . . . . . . . . . . . . . . . 354 33.9 What is a final class? . . . . . . . . . . . . . . . . . . . . . . . . . 354 33.10What is a final member function? . . . . . . . . . . . . . . . . . . 355 33.11How can final classes and final member functions improve performance? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356 33.12When should a nonfinal virtual function be invoked with a fully qualified name? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 33.13Should full qualification be used when calling another member function of the same class? . . . . . . . . . . . . . . . . . . . . . 358 33.14Do final classes and final member functions cause a lot of code duplication? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359 33.15Why do some developers dislike final member functions and final classes? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 33.16Can a programming language — rather than just the compiler — affect the performance of software? . . . . . . . . . . . . . . . . . 361 34 COM and ActiveX 362 34.1 Who should read this chapter? . . . . . . . . . . . . . . . . . . . 362 34.2 What is the Component Object Model? . . . . . . . . . . . . . . 362 34.3 What are ActiveX and OLE? . . . . . . . . . . . . . . . . . . . . 363 34.4 What does the name Component Object Model mean? . . . . . . 364 34.5 What is a “binary object model”? . . . . . . . . . . . . . . . . . 364 34.6 What are the key features of COM? . . . . . . . . . . . . . . . . 365 34.7 What are GUIDs? . . . . . . . . . . . . . . . . . . . . . . . . . . 365 34.8 Why does COM need GUIDs (and CLSIDs and IIDs)? . . . . . . 367 34.9 What is an interface? . . . . . . . . . . . . . . . . . . . . . . . . . 367 34.10What is the IUnknown interface? . . . . . . . . . . . . . . . . . . 369 34.11How many ways are there to specify COM interfaces? . . . . . . 370 34.12What are COM classes and COM objects? . . . . . . . . . . . . . 372 34.13How hard is it for callers to create and use a COM object? . . . 376 34.14How does COM provide language transparency? . . . . . . . . . 378 34.15How does COM provide location transparency? . . . . . . . . . . 379 34.16What types of errors occur due to reference counting? . . . . . . 380 34.17What mechanism does COM define for error handling? . . . . . . 381 34.18How are interfaces versioned? . . . . . . . . . . . . . . . . . . . . 381 34.19Is COM object oriented? . . . . . . . . . . . . . . . . . . . . . . . 382 34.20What is the biggest problem with COM? . . . . . . . . . . . . . 383 34.21What are the major differences between COM and C++? . . . . 384 34.22What should a class be defined as a COM class? . . . . . . . . . 386 34.23What is Automation? . . . . . . . . . . . . . . . . . . . . . . . . 388 34.24What are dispatch interfaces? . . . . . . . . . . . . . . . . . . . . 388 34.25When should a class expose a Dispatch interface? . . . . . . . . . 389 34.26How does Automation work? . . . . . . . . . . . . . . . . . . . . 390 34.27How does Invoke accomplish all of this? . . . . . . . . . . . . . . 392 xv 34.28What is a type library? . . . . . . . . . . . . . . . . . . . . . . . 392 34.29What are the benefits of using type libraries? . . . . . . . . . . . 393 34.30How do type libraries improve performance? . . . . . . . . . . . . 394 34.31What are dual interfaces? . . . . . . . . . . . . . . . . . . . . . . 394 34.32What limitations are there on dual interfaces? . . . . . . . . . . . 395 34.33What are OLE custom controls and ActiveX controls? . . . . . . 396 34.34Why do ActiveX controls differ from OLE custom controls? . . . 397 34.35What is a control container? . . . . . . . . . . . . . . . . . . . . . 398 34.36What are component categories? . . . . . . . . . . . . . . . . . . 399 34.37What are events? . . . . . . . . . . . . . . . . . . . . . . . . . . . 399 34.38What is DCOM? . . . . . . . . . . . . . . . . . . . . . . . . . . . 400 34.39How stable is DCOM’s infrastructure? . . . . . . . . . . . . . . . 401 34.40What is COM+? . . . . . . . . . . . . . . . . . . . . . . . . . . . 401 35 Transitioning to CORBA 403 35.1 What is CORBA? . . . . . . . . . . . . . . . . . . . . . . . . . . 403 35.2 What is an ORB? . . . . . . . . . . . . . . . . . . . . . . . . . . 403 35.3 What is IDL? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403 35.4 What is COS? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404 35.5 What is OMA? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404 35.6 What is OMG? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404 35.7 What is the purpose of this chapter? . . . . . . . . . . . . . . . . 404 35.8 What is the most important message of this chapter? . . . . . . . 405 35.9 What are the important concepts behind CORBA? . . . . . . . . 405 35.10Isn’t OMG IDL pretty much the same as C++? . . . . . . . . . . 406 35.11Is the life cycle of a CORBA object the same as the life cycle of a C++ object? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407 35.12Is the C++ code that interacts with the CORBA implementation portable to a different CORBA vendor? . . . . . . . . . . . . . . 408 35.13How do CORBA exceptions compare to C++ exceptions? . . . . 408 35.14Which CORBA implementation is best? Is CORBA better than COM? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409 36 C Language Considerations 410 36.1 What are the main issues when mixing C and C++ code in the same application? . . . . . . . . . . . . . . . . . . . . . . . . . . . 410 36.2 How can C++ code call C code? . . . . . . . . . . . . . . . . . . 410 36.3 How can C code call C++ code? . . . . . . . . . . . . . . . . . . 411 36.4 Why is the linker giving errors for C functions called from C+ functions and vice versa? . . . . . . . . . . . . . . . . . . . . . . 412 36.5 How can an object of a C++ class be passed to or from a C function? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413 36.6 Can a C function directly access data in an object of a C++ class?414 36.7 Can C++ I/O (<iostream>) be mixed with C I/O (<stdio.h)? 415 36.8 Which is safer: <iostream> or <stdio.h>? . . . . . . . . . . . . 416 36.9 Which is more extensible: <iostream> or <stdio.h>? . . . . . . 416 36.10Which is more flexible: <iostream> or <stdio.h>? . . . . . . . . 416 36.11Why does it seem that C++ programming feels farther away from the machine than C? . . . . . . . . . . . . . . . . . . . . . . . . . 417 36.12Why does C++ do more things behind your back than C does? . 417 xvi 37 Private and Protected Inheritance 418 37.1 What are private inheritance and protected inheritance? . . . . . 418 37.2 What is the difference between private inheritance and protected inheritance? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 37.3 What is the syntax and semantics for private and protected inheritance? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 37.4 When should normal has-a be used, rather than private or protected inheritance? . . . . . . . . . . . . . . . . . . . . . . . . . . 421 37.5 What are the access rules for public, protected, and private inheritance? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421 37.6 In a private or protected derived class, how can a member function that was public in the base class be made public in the derived class? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422 37.7 Should a pointer be cast from a private or protected derived class to its base class? . . . . . . . . . . . . . . . . . . . . . . . . . . . 423 38 Pointers to Member Functions 424 38.1 What is the type of a pointer to a nonstatic member function? . 424 38.2 Can pointers to nonstatic member functions be passed to signal handlers, X event call-back handlers, and so on, that expect Clike function pointers? . . . . . . . . . . . . . . . . . . . . . . . . 425 38.3 What is one of the most common errors when using pointers to member functions? . . . . . . . . . . . . . . . . . . . . . . . . . . 426 38.4 How is an array of pointers to nonstatic member functions declared?427 39 The Transition to OO and C++ 429 39.1 Who should read this chapter? . . . . . . . . . . . . . . . . . . . 429 39.2 What are the key messages of this chapter? . . . . . . . . . . . . 429 39.3 How many stages of technical expertise are there in the transition?430 39.4 Why bother defining levels of expertise? . . . . . . . . . . . . . . 430 39.5 Can OO/C++ be learned from a book? . . . . . . . . . . . . . . 431 39.6 Can OO/C++ be learned from a course? . . . . . . . . . . . . . 431 39.7 What is the key to learning OO/C++? . . . . . . . . . . . . . . 432 39.8 Are small projects a good way to get your feet wet? . . . . . . . 432 39.9 Does being a good C programmer help when learning OO/C++? 433 39.10What skills help when learning OO/C++? . . . . . . . . . . . . . 434 xvii Download: http://www.megaupload.com/?d=L1JWUMNO http://www.mediafire.com/?5r7o38pmm47s3m0 http://www.multiupload.com/O42Y08NUVF http://www.fileshare.ro/28930635804.8 http://www.girlshare.ro/2645981.8
  6. El - 15 ani Ei - 19 ani si mai multi Da, daca sunt decat 7-8 ii poti bate lejer.
  7. UEFI secure booting Sep. 20th, 2011 02:01 pm by mjg59 Since there are probably going to be some questions about this in the near future: The UEFI secure boot protocol is part of recent UEFI specification releases. It permits one or more signing keys to be installed into a system firmware. Once enabled, secure boot prevents executables or drivers from being loaded unless they're signed by one of these keys. Another set of keys (Pkek) permits communication between an OS and the firmware. An OS with a Pkek matching that installed in the firmware may add additional keys to the whitelist. Alternatively, it may add keys to a blacklist. Binaries signed with a blacklisted key will not load. There is no centralised signing authority for these UEFI keys. If a vendor key is installed on a machine, the only way to get code signed with that key is to get the vendor to perform the signing. A machine may have several keys installed, but if you are unable to get any of them to sign your binary then it won't be installable. This impacts both software and hardware vendors. An OS vendor cannot boot their software on a system unless it's signed with a key that's included in the system firmware. A hardware vendor cannot run their hardware inside the EFI environment unless their drivers are signed with a key that's included in the system firmware. If you install a new graphics card that either has unsigned drivers, or drivers that are signed with a key that's not in your system firmware, you'll get no graphics support in the firmware. Microsoft requires that machines conforming to the Windows 8 logo program and running a client version of Windows 8 ship with secure boot enabled. The two alternatives here are for Windows to be signed with a Microsoft key and for the public part of that key to be included with all systems, or alternatively for each OEM to include their own key and sign the pre-installed versions of Windows. The second approach would make it impossible to run boxed copies of Windows on Windows logo hardware, and also impossible to install new versions of Windows unless your OEM provided a new signed copy. The former seems more likely. A system that ships with only OEM and Microsoft keys will not boot a generic copy of Linux. Now, obviously, we could provide signed versions of Linux. This poses several problems. Firstly, we'd need a non-GPL bootloader. Grub 2 is released under the GPLv3, which explicitly requires that we provide the signing keys. Grub is under GPLv2 which lacks the explicit requirement for keys, but it could be argued that the requirement for the scripts used to control compilation includes that. It's a grey area, and exploiting it would be a pretty good show of bad faith. Secondly, in the near future the design of the kernel will mean that the kernel itself is part of the bootloader. This means that kernels will also have to be signed. Making it impossible for users or developers to build their own kernels is not practical. Finally, if we self-sign, it's still necessary to get our keys included by ever OEM. There's no indication that Microsoft will prevent vendors from providing firmware support for disabling this feature and running unsigned code. However, experience indicates that many firmware vendors and OEMs are interested in providing only the minimum of firmware functionality required for their market. It's almost certainly the case that some systems will ship with the option of disabling this. Equally, it's almost certainly the case that some systems won't. It's probably not worth panicking yet. But it is worth being concerned. Sursa: mjg59 | UEFI secure booting
  8. BitDefender Gonzales – un nou concept antivirus (testare Beta) By Radu FaraVirusi(com) on September 20, 2011 BitDefender a lansat un nou concept de antivirus sub denumirea Gonzales. Produsul va fi absolut gratuit si dupa lansarea versiunii finale, acum putand fi testat Beta. Despre ce este vorba? Combina scanarea ‘cloud’ cu protectia proactiva ‘Active Virus Control’ si are alaturi un scut anti phishing. Produsul este automat, rapid, silentios si promite o protectie excelenta. Care este filozofia Gonzales? Gonzales este un nou concept antivirus care integreaza cele mai avansate tehnologii de blocare a amenintarilor informatice, oferind siguranta maxim? cu un consum minim de resurse. Cei care-l testeaza si raporteaza probleme intalnite pot castiga un mini laptop: Samsung NC215 Pentru a descarca si testa GRATUIT BitDefender Gonzales accesati site-ul: http://gonzales.bitdefender.ro/ Sursa: BitDefender Gonzales – un nou concept antivirus (testare Beta)
  9. Lasand prostiile: 1) Baga-te in seama cu ei, razi la glumele lor de cacat, daca iti zic ca ai cosuri zi-le ca daca iti tii respiratia iese fum pe ele, nu stiu, fa caterinca, cu alte cuvinte "fii ca ei" 2) Du-te la sala. Asta nu o sa te ajute sa ii bati, dar o sa iti dea mai multa incredere in tine, o sa arati mai a "barbat" si nu o sa te mai ia la misto.
  10. Te imbraci ca un maniac in negru si arati ca Satana cu chip uman? Probabil nu. Daca te imbraci si tu normal, arati normal, nu o sa aiba nimeni nimic cu tine. Si nu te bat fara motiv. Ca isi bat joc de tine e una, dar nu au de ce sa te bata.
  11. Am vazut si eu o pagina de scam a "hackerilor din Valcea". Continea HTML-ul un <input type="hidden" name="mail" value="hacker_de_2_lei@yahoo.com" /> Pai cum sa nu fie prinsi?
  12. Pentru cei pasionati de C++, asta e ceva obligatoriu de citit. Table of Contents: [1] Copying permissions [2] On-line sites that distribute this document Updated! [3] C++-FAQ-Book versus (on-line) C++-FAQ [4] Recent changes to this document Updated! [5] Netiquette when posting to comp.lang.c++ [6] Big Picture Issues [7] Classes and objects [8] References [9] Inline functions [10] Constructors Updated! [11] Destructors [12] Assignment operators [13] Operator overloading Updated! [14] Friends [15] Input/output via <iostream> and <cstdio> [16] Freestore management Updated! [17] Exceptions and error handling Updated! [18] Const correctness [19] Inheritance — basics [20] Inheritance — virtual functions [21] Inheritance — proper inheritance and substitutability [22] Inheritance — abstract base classes (ABCs) [23] Inheritance — what your mother never told you [24] Inheritance — private and protected inheritance [25] Inheritance — multiple and virtual inheritance [26] Built-in / intrinsic / primitive data types [27] Coding standards [28] Learning OO/C++ [29] Newbie Questions / Answers Updated! [30] Learning C++ if you already know Smalltalk [31] Reference and value semantics [32] How to mix C and C++ Updated! [33] Pointers to member functions Updated! [34] Container classes Updated! [35] Templates Updated! [36] Serialization and Unserialization Updated! [37] Class libraries Updated! [38] Compiler dependencies Updated! [39] Miscellaneous technical issues [40] Miscellaneous environmental issues Online: http://www.parashift.com/c++-faq-lite/ Nu cred ca a mai fost postat. Oricum, recomand.
  13. Zbor utilizatori vechi cu peste 8 avertismente. Adica vede o data, vede de doua ori ca injura, ca face caterinca sau cine stie ce mai face, dar de 7 ori? E bataie de joc.
  14. Mosad, esti suparat ca nu ai intrat in grupul de vulnerabilitati? Deci, ce treaba am eu aici? Ca iti dau avertisment cand injuri sau faci caterinca? Acestea sunt regulile. In fine, drum bun.
  15. Nytro

    Protest!

    Poti pleca si fara ban si fara sa te dai in spectacol si sa deschizi un topic de cacat.
  16. La cine te referi in mod explicit?
  17. Deci, pe scurt: toate femeile sunt proaste, dar din pacate nu toate sunt curve. Asa sa fie?
  18. "dar te avertizez ca n-am chef de combinatii cu nimeni" Cum ma asteptam, varsta cuprinsa intre 15 si 17 ani. Daca ai mai mult deja imi pare rau pentru tine. Esti minora. Topicul e penibil. Ce treaba are regulamentul cu faptul ca toata lumea isi bate joc de tine? Si Surge e fata si nimeni nu are nicio treaba cu ea. Da, nu toate femeile sunt proaste, dar tu esti una dintre cele proaste. PS: Continuati, acum vad si eu topicul, inca imi place.
  19. Da, le oferi pe tava celor de la cazare. Si eu am auzit despre ei ca sunt niste criminali in serie pasionati de uciderea celor care se cazeaza acolo, vanandu-i ca pe niste animale la adresele lor, pe care le gasesc in buletin. Voi ati iesit in lume? Ce cacat fac cei de la cazare cu datele voastre? Doar nu o sa le aratati tuturor participantilor ce mecla aveti in buletin.
  20. Andrei a discutat cu mine inainte de a posta. Iar RST e implicat direct in acest proiect, nu e nicio problema, foarte multi membri RST vor participa.
  21. Teste programare online Sunt multe, am facut si eu doua, trebuie sa introduceti mail-ul corect. Nu sunt foarte dificile dar mi-au placut. http://tools.people-centric.ro/index.php?option=com_otests&view=order
  22. Norton Anti-Theft Beta – Protectie pentru laptop, smartphone sau tableta By Radu FaraVirusi(com) on September 15, 2011 Norton Anti-Theft este un nou produs de la Symantec ce iti permite localizarea si blocarea PC-ului, tabletei sau smartphone-ului, protejandu-ti datele pretioase, in cazul unui furt sau pierderi. Poti folosi pentru aceasta orice browser, de oriunde, oricand pentru a-l detecta si bloca de la distanta. Video: http://www.youtube.com/watch?v=4V9esM_76uI Programul este in testare Beta si cei doritori il pot descarca accesand site-ul: https://antitheft-beta.norton.com/ Sursa: Norton Anti-Theft Beta – Protectie pentru laptop, smartphone sau tableta
  23. Nytro

    Limbaj

    In primul rand nu intra in while: var times = 2; while (times < 2 ) Apoi, cred ca voia sa fie un times++; In fine, da, e mai mult "pseudocod". Porcarie.
  24. Faci un executabil in C care face ce face acel Batch si gata. Dar na, si ala poate fi dezasamblat.
×
×
  • Create New...