[haiku] Re: Tired of waiting
- From: Jaroslav Šmíd <dataman64bit@xxxxxxxxx>
- To: haiku@xxxxxxxxxxxxx
- Date: Sat, 19 Feb 2011 02:12:51 +0100
If you correctly solve these tasks, I will consider you "good enough"
C/C++ programmer.
1) Your task is to write a function. Its first argument is pointer to
first element of the array of ints. Second arguments is number of
elements in the array. Iterate through all of them and print them to
standard output, each on a new line. Declare and define the function,
mark in the code (by comments) what is definition and what is declaration.
2) Is anything wrong with following code? If yes, what:
MyObject* o1, o2;
long a;
o1 = new(std::nothrow) MyObject();
o2 = new(std::nothrow) MyObject();
o1->doSomething();
o2->doSomethingElse();
a = (long)o1;
o1 = o2;
o2 = (MyObject*)a;
3) Is anything wrong with following code? If yes, what:
uint16_t arr[2] = { 5, 6 };
(*(int32_t*)arr) = UINT32_C(0);
On 02/10/2011 11:48 PM, Ari Haviv wrote:
No, it's not what you think. :)
I'm tired of waiting and not doing anything about Haiku (or BeOS for
that matter because I waited hoping for Be inc to pull it off in those
days). That I'd just 'do my part' after Haiku is 99% polished and
perfect and only then would I help by testing out almost completed
software or promoting the Haiku idea to the masses. I decided I'm
actually going to 'do' this programming thing and learn how to create
something. So I picked up the Gaddis C++ book that was untouched (it
was for a college course years ago and I just wasn't into it at the
time) and worked on the exercises.
If you are just starting out and just read a book that's full of
#<>{};, your mind just turns blank. But I forced myself to do all the
checkpoints, review questions and all the programming challenges for
each chapter and then I realized that this stuff wasn't so bad after
all. I also came up with my own commenting system so that I could keep
track of all those braces. For example, if the beginning of the loop
is: if (x>2) then after the closing brace I write // if if (x> 2)
Once I finish this book, the next step will be to get C++ Primer and
other books to really know C++.
Other related posts: