Click here to Skip to main content
15,890,123 members

Nemanja Trifunovic - Professional Profile



Summary

LinkedIn      Blog RSS
21,629
Author
7,688
Authority
38,583
Debator
30
Editor
102
Enquirer
12,739
Organiser
9,705
Participant
Born in Kragujevac, Serbia. Now lives in Boston area with his wife and daughters.

Wrote his first program at the age of 13 on a Sinclair Spectrum, became a professional software developer after he graduated.

Very passionate about programming and software development in general.

Reputation

Weekly Data. Recent events may not appear immediately. For information on Reputation please see the FAQ.

Privileges

Members need to achieve at least one of the given member levels in the given reputation categories in order to perform a given action. For example, to store personal files in your account area you will need to achieve Platinum level in either the Author or Authority category. The "If Owner" column means that owners of an item automatically have the privilege. The member types column lists member types who gain the privilege regardless of their reputation level.

ActionAuthorAuthorityDebatorEditorEnquirerOrganiserParticipantIf OwnerMember Types
Have no restrictions on voting frequencysilversilversilversilver
Bypass spam checks when posting contentsilversilversilversilversilversilvergoldSubEditor, Mentor, Protector, Editor
Store personal files in your account areaplatinumplatinumSubEditor, Editor
Have live hyperlinks in your profilebronzebronzebronzebronzebronzebronzesilverSubEditor, Protector, Editor
Have the ability to include a biography in your profilebronzebronzebronzebronzebronzebronzesilverSubEditor, Protector, Editor
Edit a Question in Q&AsilversilversilversilverYesSubEditor, Protector, Editor
Edit an Answer in Q&AsilversilversilversilverYesSubEditor, Protector, Editor
Delete a Question in Q&AYesSubEditor, Protector, Editor
Delete an Answer in Q&AYesSubEditor, Protector, Editor
Report an ArticlesilversilversilversilverSubEditor, Mentor, Protector, Editor
Approve/Disapprove a pending ArticlegoldgoldgoldgoldSubEditor, Mentor, Protector, Editor
Edit other members' articlesSubEditor, Protector, Editor
Create an article without requiring moderationplatinumSubEditor, Mentor, Protector, Editor
Approve/Disapprove a pending QuestionProtector
Approve/Disapprove a pending AnswerProtector
Report a forum messagesilversilverbronzeProtector, Editor
Approve/Disapprove a pending Forum MessageProtector
Have the ability to send direct emails to members in the forumsProtector
Create a new tagsilversilversilversilver
Modify a tagsilversilversilversilver

Actions with a green tick can be performed by this member.


 
GeneralRe: How to use C++/CLI? Pin
Nick Parker29-Jul-04 9:20
protectorNick Parker29-Jul-04 9:20 
GeneralRe: How to use C++/CLI? Pin
Nemanja Trifunovic29-Jul-04 13:58
Nemanja Trifunovic29-Jul-04 13:58 
GeneralRe: How to use C++/CLI? Pin
Nick Parker29-Jul-04 17:29
protectorNick Parker29-Jul-04 17:29 
GeneralMy first hands on experience with generics Pin
Nemanja Trifunovic17-Jul-04 8:41
Nemanja Trifunovic17-Jul-04 8:41 
GeneralBad habits of "old-style" programming Pin
Nemanja Trifunovic13-Jul-04 3:05
Nemanja Trifunovic13-Jul-04 3:05 
GeneralC++/CLI - ref objects on native heap Pin
Nemanja Trifunovic11-Jul-04 7:11
Nemanja Trifunovic11-Jul-04 7:11 
GeneralRe: C++/CLI - ref objects on native heap Pin
Brian Olej11-Jul-04 7:27
Brian Olej11-Jul-04 7:27 
GeneralRAII with C++/CLI Pin
Nemanja Trifunovic10-Jul-04 10:11
Nemanja Trifunovic10-Jul-04 10:11 
I wrote the next piece of code today:

System::IO::StreamReader^ file = new System::IO::StreamReader(L"test.txt");
String^ line = file->ReadLine();
Console::WriteLine(line);
file->Close();


and got the compiler error error C2750: 'System::IO::StreamReader' : cannot use 'new' on the reference type; use 'gcnew' instead.

Of course, of course... even with old MC++ I would usually type
System::IO::StreamReader __gc* file = __gc new System::IO::StreamReader(S"test.txt");

, but it is still too easy to forget. Anyway, if we correct this typo, we end up with:

System::IO::StreamReader^ file = gcnew System::IO::StreamReader(L"test.txt");
String^ line = file->ReadLine();
Console::WriteLine(line);
file->Close();


It compiles and runs fine. However, I would never put something like this into production code. Why? Because StreamReader::ReadLine() can throw an exception, and if it does we have a resource leak - the file never gets closed. One way to make this code exception safe is to rewrite it like this:

System::IO::StreamReader^ file = nullptr;
try
{
    file = gcnew System::IO::StreamReader(L"test.txt");
    String^ line = file->ReadLine();
    Console::WriteLine(line);
}
finally
{
    if (file != nullptr)
        file->Close();
}


Now, that is too much work, and many developers are just too lazy to write the finally clause. In fact, I can't really blame them. This is way too tedious way to make your code exception safe.

Tha right way to take care about resource management is a technique called RAII. If you don't know much about RAII, I strongly encourage you to read this article by Jon Hanna[^]. This idiom is so simple and effective that I even consider keyword finally a flaw in a programming language, because it is either a sign that RAII is not supported, or encourages developers not to use it.

The problem is that RAII does not go well with nondeterministic GC envirinments. For instance, it is impossible to implement it in Java or VB.NET 2003. In C#, there is using keyword wich enables some kind of poor man's RAII mechanism, but even that is too much work IMHO, and I know some C# developers who just don't get why they should bother with using. Even more, in the first edition of Professional C#[^] the author recommends avoiding using which is IMHO a crime.

In old MC++, there is no built in support for RAII. However, I wrote a template class[^] that gives developer a possibility to use RAII, although with some performance cost.

One of the big things about C++/CLI is supposed to be the return of deterministic finalization and support for RAII. Having read an interview with Nick Hodapp[^], I expected to be able to modify my code like this:

System::IO::StreamReader file(L"test.txt");
String^ line = file.ReadLine();
Console::WriteLine(line);


but I got error C3149: 'System::IO::StreamReader' : cannot use this type here without a top-level '^'. Huh? How do we use deterministic finalization with C++/CLI? I'll try to investigate this, and get back to you later.



My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
GeneralRe: RAII with C++/CLI Pin
Nemanja Trifunovic10-Jul-04 10:19
Nemanja Trifunovic10-Jul-04 10:19 
GeneralTrivial (and less trivial) properties Pin
Nemanja Trifunovic9-Jul-04 9:36
Nemanja Trifunovic9-Jul-04 9:36 
GeneralRe: Trivial (and less trivial) properties Pin
Jörgen Sigvardsson11-Jul-04 10:12
Jörgen Sigvardsson11-Jul-04 10:12 
GeneralRe: Trivial (and less trivial) properties Pin
Nemanja Trifunovic11-Jul-04 12:01
Nemanja Trifunovic11-Jul-04 12:01 
GeneralRe: Trivial (and less trivial) properties Pin
Jörgen Sigvardsson11-Jul-04 12:04
Jörgen Sigvardsson11-Jul-04 12:04 
GeneralRe: Trivial (and less trivial) properties Pin
Dejan Gojsevic11-Jul-04 15:18
Dejan Gojsevic11-Jul-04 15:18 
GeneralRe: Trivial (and less trivial) properties Pin
Nemanja Trifunovic11-Jul-04 15:36
Nemanja Trifunovic11-Jul-04 15:36 

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.