changeset:   5133:a2360a43963f
tag:         tip
user:        Anders Widell <[email protected]>
date:        Thu Apr 10 09:41:05 2014 +0200
summary:     osaf: Fix RPM build by adding saAis_B_5_14.h to spec [#625]

[staging:a2360a]


---

** [tickets:#625] osaf: Support constant strings in SAF APIs**

**Status:** fixed
**Milestone:** 4.5.FC
**Created:** Wed Nov 13, 2013 11:25 AM UTC by Anders Widell
**Last Updated:** Wed Apr 02, 2014 02:58 PM UTC
**Owner:** Anders Widell

There is a fundamental problem with the **SaStringT** type as it is currently 
defined:

    typedef char* SaStringT;

When **SaStringT** is defined like this, it is impossible to declare a string 
constant using it. For example, a variable decleared like this:

    const SaStringT x;

has the following meaning:

    char *const x;

i.e., it is only the pointer **x** that is constant, not the string that it is 
pointing to.

There are several possible ways to support constant strings in the SAF APIs:

1) Introduce a new type **SaCharT**, and use **SaCharT** pointers in the API 
calls instead of **SaStringT**. Since **SaStringT** is defined as a character 
pointer, it should be possible to replace occurrences of **SaStringT** with ** 
SaCharT* ** without breaking backwards compatibility.

2) Replace the **SaStringT** typedef with a C preprocessor macro, like this:

    #define SaStringT char*

3) Intruduce a new type **SaConstStringT**:

    typedef const char* SaConstStringT;

The proposal is to go for 3), and to begin with only define the new type. The 
new type can later on be used when defining new APIs.



---

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.
------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Opensaf-tickets mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-tickets

Reply via email to