Comments (5)
Hm, interesting, but the way I read it is that the restrictions stated there constrain implementations of POSIX and what implementation-specific symbols they can add to POSIX header files. AFAICS they do not constrain third-party libraries with independent header files.
For the Wasm API, all C names have consciously been given a wasm_ prefix, so I expect the potential for conflict to be minimal to non-existent.
from wasm-c-api.
The suffix is reserved for all POSIX and C headers. (Note the [CX], which means it's extending the C standard, which means its reserving for C headers as well.) If your code never includes a header like <stdlib.h>, then you're good. I've written C source file that didn't include any C or POSIX header. But if your code includes such a header and also defines identifiers (directly or indirectly) with the _t suffix, then there's potential for namespace clash, especially if you're defining them in headers to be used by other applications.
In practice few people know this, let alone obey it. But I figured standards should probably be neighborly.
from wasm-c-api.
Sigh, modularity and name spacing are such a sad story in C.
The only unqualified type names we define are the byte_t, float32_t, and float64_t synonyms. I agree that we should probably avoid those. (It's unfortunate that they do not exist in any standard header.)
For everything else I don't know. We indeed include some C headers. However, as mentioned, all our names are sanitised with wasm_ prefixes. If POSIX makes such a sweeping land grab in the C name space that it even prevents harmless uses like that -- and generally is in conflict with large parts of dev reality -- then I don't know if third parties should feel obliged to obey to the letter. And I'm saying that as a person who usually very much prefers conforming to standards
from wasm-c-api.
FWIW, the use of _t in the API doesn't really add anything. For years, before I read and understood the standards, I thought _t was an idiom for scalar typedefs (integers, pointers) or more generally (in my rationalizations) POD types that could be copied by simple assignment, and that's how I always used it. IME most software that uses _t rarely uses it for aggregate objects like structs or unions. What originally clued me into the issue was how the pthreads API uses _t for aggregate objects, including ones that couldn't be copied, which seemed irregular until I learned that the whole point of _t was for namespacing, not readability.
That said, I only wanted to bring the issue to your attention. I don't care to bikeshed style. Feel free to dispose of this issue however you want ;)
from wasm-c-api.
Actually, the main benefit of the convention from my perspective is that you don't get into syntactic issues where you want to name a variable or function after a type, because C syntax does not properly separate the name spaces.
Anyway, thanks for bringing this up. I at least want to reconsider the use of unqualified type names.
from wasm-c-api.
Related Issues (20)
- Embedding multiple engines implementing wasm C API HOT 3
- undefined reference to `wasm::vec<char>::free_data()'
- Syslog HOT 2
- Custom Sections API HOT 4
- WASM proposals supporting in Wasm C API HOT 1
- API to Terminate Execution for a wasm::Store
- Expectations for serialize/deserialize HOT 4
- make error:error: use of undeclared identifier 'errc' struct is_error_condition_enum<errc> HOT 1
- docker build fails in C++ Multi test HOT 2
- AddressSanitizer: allocation-size-too-big HOT 3
- Access of v8 isolate possible? HOT 1
- Deprecate wasm-c-api on big-endian hosts HOT 12
- Support import globals callback HOT 6
- posix shared memory with wamr
- Metering API
- `vec<T>::make_nt` may not be so helpful HOT 1
- Please tag when used in wabt
- memory64 support
- Type constructors should have a `wasm_engine_t*` parameter HOT 10
- How to import a native func to "env"? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wasm-c-api.