-
Notifications
You must be signed in to change notification settings - Fork 47
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
All global-namespaced types ending with _t must be renamed #165
Comments
I would suggest to scope this change mostly to the type that is causing the break, associated with recent changes (changes that enabled HTTP C API support):
From a practical standpoint, it appears that the scope of this change should apply to task_t only .. And while it may or may not be true for POSIX, POSIX being Operating System-level design - would unlikely implement HTTP client as a fundamental primitive. All other types are already prefixed with evt_ - Why evt? Because for some time we've been swinging back and forth between MAT (telemetry), MAE (events), so evt_ - stands for events, - i.e. most primitives already provide "unique enough" prefix. I'd suggest to avoid refactoring these to minimize the impact on API surface. task_t and http types are used by MIP SDK --- @trevorlacey-msft f.y.i. |
evt_task_t ? |
That still breaks from the POSIX standard requirement of reserving any types that end with underscore-t, I'm fine with evt_* as the prefix, especially if we use it elsewhere (updated Issue accordingly) - though I think mat.h should be renamed evt.h in that case, I don't think we need to do that as part of this Issue.
Why? I've fixed the break locally in Office, this is not an issue that requires we take on technical debt for a quick turnaround. Limiting this to only one type of three will only cause confusion in the SDK's naming scheme, which we should be unified on. |
My suggestion is we tackle this in several stages:
|
Examples of code bases that are NOT following the POSIX guideline, but running fine on POSIX-compliant Operating Systems:
|
EDIT: I stand corrected, Windows does provide an optional POSIX implementation https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux. That said, windows.h (and subheaders in the SDK) defining _t types is allowed, as it itself is the implementation, and is thus allowed to use things that are reserved for the implementation. I don't know why we wouldn't just remove the _t all together from our mat.h types. The type name is already changing, there's going to need to be a code change, so might as well get it all in a compliant state. POSIX compliance (or best effort that we can) should be a requirement for us if we intend to run in POSIX environments, certainly we shouldn't actively defy standards when we have the opportunity to adhere to them, especially when the set of consumers of mat.h is relatively small. Paying the cost now thus is way better than having to pay the cost after going to OSS and having potentially gazillions of diverse and disparate consumers. Finally, the fact that other projects have done things that violate rules for things reserved by the implementation doesn't give us justification to do so. |
@mkoscumb - we'd have to be reasonable and practical with respect to who's already consuming the implementation in environments outside of Office. I don't find it practical nor reasonable to refactor this for v3.2. The best "least cost effort" course of action for v3.2 is to add evt_ prefix to task_t , that resolves your build break. We can debate what's best for v3.5+ , and how we can address this / document this to all customers upgrading from v3.2 to v3.5. It'd be great to provide some markdown document with upgrade instructions, assuming we do not want to #define SOMETHING_t SOMETHING to assist with an upgrade. I don't think we can afford renaming this type in v3.2 at this point neither in October nor in November timeframe. |
@mkoscumb - Hi Matt, I looked closer at this issue. There is a practical reason why we can never fully satisfy this requirement. I double-checked that our fav While POSIX (soft) requirement is nice-to-satisfy, I do not believe the I think we should just let it go. Proof link showing |
....MAYBE only a change in |
Issue
The POSIX standard reserves any type identifier ending with underscore-lower-case-t (_t). As the Client Telemetry SDK defines a number of these in the CAPI header (mat.h), this has the potential for collisions and compiler errors if a translation unit includes a POSIX header which uses these types and mat.h
Office has observed these collisions including mat.h in files that also (through a chain of includes) include MACH headers on OSX.
Impact
From a public API perspective, this appears to only impact types in the global namespace, which means the fix can be scoped entirely to mat.h. There will of course be a few unit test and implementation changes as well.
Proposed Solution
Prefix all mat.h types with evt_* (thanks Max for the prior art), and remove all _t suffixes. As type names are changing, this should also cause a major-version-increment. Also update the coding-standards document to add a section for C type names.
The text was updated successfully, but these errors were encountered: