Skip to content

API doc need to be improved to provide semantic of returned nullptr #133

@FrankYFTang

Description

@FrankYFTang

During the review of #132 we discovered the API doc for some of the function is lacking the information about the sematic of returned nullptr value

Here are two examples, both on InflectableStringConcept
https://github.com/unicode-org/inflection/blob/main/inflection/src/inflection/dialog/InflectableStringConcept.hpp#L16

   /**
     * Returns the Speakable String representing the given semantic feature.
     *
     * @param feature - the semantic feature for which the value is requested.
     * @return Speakable String
     */
    SpeakableString* getFeatureValue(const SemanticFeature& feature) const override;

...
    /**
     * Converts the concept to a Speakable String
     *
     * @return Speakable String
     */
    SpeakableString* toSpeakableString() const override;
    /**
     * Clones the concept
     *
     * @return concept
     */
    InflectableStringConcept* clone() const override;

all these three may return nullptr or a valid pointer. We should document what the caller should do when it is not nullptr (to delete them to release memory) and what does that mean when the return value is nullptr (error condition or somethin else)

@grhoten @nciric

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions