Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C domain: allow inline reference to pointer of a defined type #10704

Closed
marxin opened this issue Jul 25, 2022 · 2 comments
Closed

C domain: allow inline reference to pointer of a defined type #10704

marxin opened this issue Jul 25, 2022 · 2 comments
Labels
domains:c type:enhancement enhance or introduce a new feature

Comments

@marxin
Copy link
Contributor

marxin commented Jul 25, 2022

It's quite common that one needs to explain that a pointer of a type is returned:

.. c:type:: my_type

This works :c:type:`my_type`, but I would like to point
to a pointer of the type (:c:type:`my_type *`).

but one gets:

/tmp/demo/source/index.rst:15: WARNING: Unparseable C cross-reference: 'my_type *'
Invalid C declaration: Expected end of definition. [error at 8]
  my_type *
  --------^

@jakobandersen Is it something that can be supported, please?

@marxin marxin added the type:enhancement enhance or introduce a new feature label Jul 25, 2022
@jakobandersen
Copy link
Contributor

The type directive is for declaring a type alias so that won't work.
If it's a return type then something like the following can be done:

... c:function:: Foo *f()

   :returns: a pointer to the thing.
   :rtype: Foo*

In general you can use the expr role in inline text, it accepts both expressions and types.

@marxin
Copy link
Contributor Author

marxin commented Jul 25, 2022

Yep, thanks, :expr: role works very well!

@marxin marxin closed this as completed Jul 25, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
domains:c type:enhancement enhance or introduce a new feature
Projects
None yet
Development

No branches or pull requests

2 participants