Agree with this.
You mentioned c++ exceptions.
Lets not start writing code for *catching* exceptions for now, since that can
have quite heavy performance/stack-memory implications.
That means thrown exceptions will be like asserts.
/AndersBj
________________________________
From: Anders Widell [mailto:[email protected]]
Sent: den 5 februari 2014 12:28
To: [email protected]
Subject: [tickets] [opensaf:tickets] #713 AMF refactoring for 4.5
One big improvement in C++ is the possibility to use std::string instead of C
character arrays. C++ strings are much less error-prone, e.g. you can almost
eliminate the risk for "buffer overflow" type of errors in string handling
(which is still a common cause of security vulnerabilities in many
applications), and if you use the error-checking at() method for accessing
individual characters, you will get an out_of_range exception if you try to
access a position that is out of bounds. Furthermore, it manages dynamic memory
allocation internally, which eliminates the need for malloc() & free() and thus
the risk for memory leaks. In C, it is all too common to use a fixed-size
buffer for storing strings, just to avoid the malloc() / free() hazzle. Using a
fixed-size buffer is not a good alternative, since it introduces an arbritrary
limit on the maximum string length, and it wastes memory since most of the time
only a small fraction of the buffer will be utilized.
Since we are planning to increase (or remove) the length limit for DNs, we need
to eliminate the usage of SaNameT internally in the OpenSAF services. Here,
std::string also comes in handy as a replacement for SaNameT. SaNameT should
only be used where it is absolutely necessary, i.e. in APIs due to backward
compability reasons.
________________________________
[tickets:#713]<http://sourceforge.net/p/opensaf/tickets/713/> AMF refactoring
for 4.5
Status: accepted
Created: Fri Jan 10, 2014 07:05 AM UTC by Hans Feldt
Last Updated: Tue Feb 04, 2014 06:41 PM UTC
Owner: Hans Feldt
This is a 4.5 ticket for continued code re-factoring of the AMF service for
4.5. The work started with #94 in 4.4.
So far no really no C++ features has been used. Files has been renamed so that
the C++ compiler is used and new/delete is used instead of malloc/free (where
appropriate).
In this ticket it is time to make use of C++ features to get a more
maintainable and understandable code base. We should aim for many small changes
instead of few big ones.
An ordered list of things to work on:
1. Use bool which is a native type in C++ (and remove SaBoolT)
2. Use stl::maps (instead of patricia trees)
3. Use stl::vector/list (instead of legacy/home made lists)
Other yet non prioritized items:
- Clean run of google's cpplint on the code base
- Convert model derived C structs to classes and change functions into methods
- Change macros to (inline) methods
- Change bit fields (flags) to boolean attributes (see
https://sourceforge.net/p/opensaf/tickets/717/#d4b2)
- Use references instead of pointers
- ...
Non C++ related changes:
- split up long functions into smaller ones doing one things and not many
- use pmccabe complexity analysis to aid refactoring
- set a goal for pmccabe complexity
- use const as much as possible
- ...
________________________________
Sent from sourceforge.net because [email protected] is
subscribed to https://sourceforge.net/p/opensaf/tickets/
To unsubscribe from further messages, a project admin can change settings at
https://sourceforge.net/p/opensaf/admin/tickets/options. Or, if this is a
mailing list, you can unsubscribe from the mailing list.
---
** [tickets:#713] AMF refactoring for 4.5**
**Status:** accepted
**Created:** Fri Jan 10, 2014 07:05 AM UTC by Hans Feldt
**Last Updated:** Wed Feb 05, 2014 11:28 AM UTC
**Owner:** Hans Feldt
This is a 4.5 ticket for continued code re-factoring of the AMF service for
4.5. The work started with #94 in 4.4.
So far no really no C++ features has been used. Files has been renamed so that
the C++ compiler is used and new/delete is used instead of malloc/free (where
appropriate).
In this ticket it is time to make use of C++ features to get a more
maintainable and understandable code base. We should aim for many small changes
instead of few big ones.
An ordered list of things to work on:
1. Use bool which is a native type in C++ (and remove SaBoolT)
2. Use stl::maps (instead of patricia trees)
3. Use stl::vector/list (instead of legacy/home made lists)
Other yet non prioritized items:
- Clean run of google's cpplint on the code base
- Convert model derived C structs to classes and change functions into methods
- Change macros to (inline) methods
- Change bit fields (flags) to boolean attributes (see
https://sourceforge.net/p/opensaf/tickets/717/#d4b2)
- Use references instead of pointers
- ...
Non C++ related changes:
- split up long functions into smaller ones doing one things and not many
- use pmccabe complexity analysis to aid refactoring
- set a goal for pmccabe complexity
- use const as much as possible
- ...
---
Sent from sourceforge.net because [email protected] is
subscribed to http://sourceforge.net/p/opensaf/tickets/
To unsubscribe from further messages, a project admin can change settings at
http://sourceforge.net/p/opensaf/admin/tickets/options. Or, if this is a
mailing list, you can unsubscribe from the mailing list.
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-tickets mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-tickets