KhronosGroup / KhronosGroup/OpenCL-Docs
clarify printf asterisk field width specifier
- Dominant language
- Python
- Stars
- 420
- Forks
- 131
- Avg merge
- 5d 13h
- Merged PRs (30d)
- 11
Description
I was asked recently whether the OpenCL printf supports the asterisk ("*") field width specifier. I believe the answer is "no", because the description in the OpenCL C spec only says:
> The field width takes the form of a nonnegative decimal integer...
whereas the C99 spec says:
> The field width takes the form of an asterisk * (described later) or a nonnegative decimal integer.
Note that the asterisk width specifier is also not in the list of tested printf format strings in teh CTS tests ([link](https://github.com/KhronosGroup/OpenCL-CTS/blob/master/test_conformance/printf/util_printf.cpp#L30)).
I think it would be clearer if this difference were included in the [Differences between OpenCL C and C99 printf](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_C.html#differences-between-opencl-c-and-c99-printf) list.
While we're at it:
* We should also clarify that the asterisk precision specifier is not supported, similarly.
* We should describe the same restrictions in the SPIR-V environment specification.
Contributor guide
Research direction
Start with the linked OpenCL C “Differences between OpenCL C and C99 printf” section and the referenced test_conformance/printf/util_printf.cpp tests. Locate the corresponding SPIR-V environment specification text, then document the unsupported asterisk field-width and precision specifiers in both specifications and confirm the restrictions are consistent.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100