Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » General Discussions » General Discussion » I Learn Some Basic C++!
Re: I Learn Some Basic C++! [message #392518 is a reply to message #392448] Sat, 27 June 2009 06:58 Go to previous messageGo to previous message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma:
General (3 Stars)
HTT-Bird wrote on Sat, 27 June 2009 03:18

SSnipe: Grab "Accelerated C++" by Andrew Koenig and Barbara Moo. That should get you much further than anything I can post in this thread. Once you've worked through that book, you will have a good enough grasp of the language to start playing with Rene-coding.

@SK: Go read "The String Formatters of Manor Farm" by Herb Sutter. That, and we're getting varadic templates in C++0x, so expect to see something >>>> printf soon. Hint:
#include <cstdio>
int main()
{
  const char* bad = "this will blow up";
  int very = 42;
  std::printf("%s%d\n", very, bad);
  return 0;
} 


With a varadic-template-enabled version of printf, you'd get a compiler error saying "can't convert int to const char*" not Undefined Behavior (translation: crash bang boom) at runtime.


Even more reason to be a stupid programmer! I've had my fair share of mismatched format strings, but due to the fact your program will blow up at runtime and the debugger usually catches it make this quite a silly thing to impliment. A lot of the "new" C++ features a simply going to add more bloat, slower code and features, like the one above. That are useless. I personally would like to see more behaviour defined, like default calling conventions. Or even just things like i++ + i--;, even if that is trivial. Another thing would be vtable manipulation, the order of the vtable in derived classes (that have pure or non-pure virtual functions) should be another thing. Redirecting the vtable in some cases can be quite useful. As far as I know, the pointer to the table is not even defined. It could be at any offset to the instance pointer too.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Your daily commute to work!
Next Topic: Virus
Goto Forum:
  


Current Time: Thu Nov 28 21:25:48 MST 2024

Total time taken to generate the page: 0.01119 seconds