question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cython_blas does not use const in signatures

See original GitHub issue

Usually, BLAS interfaces for C use function signatures with const qualifiers - examples:

void F77_daxpy( FINT, const double *, const double *, FINT, double *, FINT);
F77_NAME(daxpy)(const int *n, const double *da,
		const double *dx, const int *incx,
		double *dy, const int *incy);

However, the Cython pxd file for cython_blas generates the function signatures without const qualifier:

cdef void daxpy(int *n, d *da, d *dx, int *incx, d *dy, int *incy) nogil

Which makes it harder to wrap into existing programs if they are using const.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:16 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
sturlamoldencommented, Dec 23, 2021

https://www.damnyouautocorrect.com I know we have a pandemic and all, but impunity is not immunity…

1reaction
sturlamoldencommented, Dec 23, 2021

It should be ok. The compiler will cast T * to const T * but not the other way around. It is the absence of const that cause the problems (i.e. requiring an explicit const_cast of const T * to T * when calling BLAS). Adding const qualifier to the prototypes can be done with impunity. It will only help to solve problems. It should not cause any backwards compatibility issues. In my opinion such a PR would be welcome.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c++ - Top-level const doesn't influence a function signature
When values are accepted by value they go out of scope as the function returns, so there's no valid scenario involving returning a...
Read more >
`const` all the things? – Arthur O'Dwyer
TLDR: I'm not putting const on all the things, either. ... This signature is saying “Please give me references to two of your...
Read more >
const - JavaScript - MDN Web Docs - Mozilla
The const declaration creates block-scoped constants, much like variables declared using the let keyword. The value of a constant can't be ...
Read more >
Python Constants: Improve Your Code's Maintainability
In practice, Python constants are just variables that never change. ... You'll use constants to represent values that won't change.
Read more >
Here's why the const keyword in Java is not implemented
Why is the const keyword in Java not implemented? It's part of the language, but it can't be used to make a variable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found