Collection of C++ Resources


how to debug c++ program before main()


set a break at _start()

  • 'start'
    • The name of the main procedure can vary from language to language. With C or C++, the main procedure name is always main, but other languages such as Ada do not require a specific name for their main procedure. The debugger provides a convenient way to start the execution of the program and to stop at the beginning of the main procedure, depending on the language used.
    • The ‘start’ command does the equivalent of setting a temporary breakpoint at the beginning of the main procedure and then invoking the ‘run’ command.
  • Some programs contain an elaboration phase where some startup code is executed before the main procedure is called. This depends on the languages used to write your program. In C++, for instance, constructors for static and global objects are executed before main is called. It is therefore possible that the debugger stops before reaching the main procedure. However, the temporary breakpoint will remain to halt execution.
  • Specify the arguments to give to your program as arguments to the ‘start’ command. These arguments will be given verbatim to the underlying ‘run’ command. Note that the same arguments will be reused if no argument is provided during subsequent calls to ‘start’ or ‘run’.
  • It is sometimes necessary to debug the program during elaboration. In these cases, using the start command would stop the execution of your program too late, as the program would have already completed the elaboration phase. Under these circumstances, insert breakpoints in your elaboration code before running your program


Dynamic Memory Management : Quick Reference

In C++, the new() and delete() operators provide built-in language support for dynamic memory allocation and deallocation. This feature has several benefits:
  • – Reduces common programmer errors: it is easy to forget to multiply the number of objects being allocated by sizeof when using malloc(), e.g., // oops, only 2 1/2 int’s! int *a = (int *) malloc (10);
  • – Enhances source code clarity: generally, there is no need to: (1) declare operator new() and delete(), (2) explicitly use casts, or (3) explicitly check the return value.
  • – Improves run-time efficiency: (1) users can redefine operator new() and delete() globally and also define them on a perclass basis and (2) calls can be inlined.


May 2014: Media coverage of High Freq Trading Stories after 'Flash Boys'


Chairman Mary Jo White Stops Short of Saying There Is an Unlevel Playing Field


On high-frequency trading, Rep. Carolyn Maloney (D., N.Y.) said she is concerned high-speed firms subscribe to data feeds that are significantly faster than data feeds that are available to the public, allowing them to detect trades before other investors can see them and take advantage of the information.

Ms. White said she doesn't believe the ability of high-frequency firms to take advantage of fast-moving market information unavailable to other investors meets the legal definition of insider trading.

"As I understand the question, as it's been described, it is not unlawful insider trading," she said, in response to questions from Mr. Garrett. She added there was "confusion" on the difference between early access to order information and certain firms' ability to "more quickly react to... public information."

NYSE to Curtail Order Types Amid Debate Over Their Fairness

  • “I am surprised Sprecher took such a strong leadership role in resolving the order type controversy,” Bodek said by e-mail today. “I applaud his efforts and hope other exchanges will follow.”
  • Eric Ryan, an NYSE spokesman, declined to provide further details about the order types that might be eliminated.

ICE Seeks to Reduce Stock Order Types at NYSE

  • As a first step toward "unilaterally reducing the excessive complexity," Mr. Sprecher said the exchange plans to apply to the Securities and Exchange Commission to eliminate roughly one dozen existing order types, without singling out which order types would be targeted for elimination.
  • Others said the types of orders the exchange ultimately removes will be as telling as the announcement itself. A 2013 report by Rosenblatt Securities found that many order types are little used.
  • "It's hard to know how consequential this will be until you see which order types they are going to get rid of," said Justin Schack, Rosenblatt's head of market structure.

Goldman, Barclays, Credit Suisse Draw High-Speed Trading Scrutiny

  • Dark pools accounted for an estimated 14% of U.S. stock-trading volume in March 2014, according to Rosenblatt, which tracks trading activity.
  • Goldman has held discussions over the future of its private stock-trading venue, called Sigma X, and in conversations with other market participants in recent months had broached the subject of shutting it down, 
  • Barclays's venue, known as LX, is among the largest in the U.S., trading an average of 110 million shares a day in March, or 11.4% of all dark-pool volume, according to Rosenblatt Securities Inc., which tracks trading activity.
  • Credit Suisse's dark pool, Crossfinder, another popular alternative-trading venue, doesn't report its volumes. 
New York Stock Exchange Suspends Trading