Skip to content

The stdlib_ascii module uses INT_KINDS instead of a list of logical kinds to generate to_string(logical) #423

Closed
@arjenmarkus

Description

@arjenmarkus

Generating the to_string function for logical arguments
The code for stdlib_ascii contains the following code:

    #:for kind in INT_KINDS
    !> Represent an logical of kind ${kind}$ as character sequence
    pure function to_string_logical_${kind}$(val) result(string)
        integer, parameter :: ik = ${kind}$
        logical(ik), intent(in) :: val
        character(len=1) :: string

        string = merge("T", "F", val)
    end function to_string_logical_${kind}$
    #:endfor

Clearly instead of INT_KINDS a macro LOG_KINDS should be used.

However, the file common.fypp which defines these macros lacks a list for logical kinds.

Expected behaviour
The file stdlib_ascii should have:

    #:for kind in LOG_KINDS
    !> Represent an logical of kind ${kind}$ as character sequence
    pure function to_string_logical_${kind}$(val) result(string)

And the file common.fypp should have:

#! Logical kinds to be considered during templating - fill in the correct names
#:set LOG_KINDS = [...] 
   
#! Logical types to be considered during templating
#:set LOG_TYPES = ["logical({})".format(k) for k in LOG_KINDS]

Technical Details
The adjustments to the code should be obvious

Compiler version
Independent of the compiler

Platform and Architecture
All platforms - it concerns the source code

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions