You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@graphar.apache.org by "yangxk1 (via GitHub)" <gi...@apache.org> on 2025/12/15 09:35:38 UTC

[I] feat(c++): Use fixed-width int32_t instead of platform-dependent int for binary layout consistency [incubator-graphar]

yangxk1 opened a new issue, #809:
URL: https://github.com/apache/incubator-graphar/issues/809

   ### Describe the enhancement requested
   
   To improve cross-platform compatibility and ensure a consistent binary layout, replace uses of the platform-dependent `int` type with the fixed-width `int32_t` type wherever a 32-bit integer is intended (e.g., in on-disk/in-memory binary formats, IPC, serialization/deserialization, and public ABI-facing structs). This avoids layout and compatibility issues when `int` size differs across platforms/compilers.
   
   ### Component(s)
   
   C++


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org
For additional commands, e-mail: commits-help@graphar.apache.org


Re: [I] feat(c++): Use fixed-width int32_t instead of platform-dependent int for binary layout consistency [incubator-graphar]

Posted by "yangxk1 (via GitHub)" <gi...@apache.org>.
yangxk1 closed issue #809: feat(c++): Use fixed-width int32_t instead of platform-dependent int for binary layout consistency
URL: https://github.com/apache/incubator-graphar/issues/809


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org
For additional commands, e-mail: commits-help@graphar.apache.org


Re: [I] feat(c++): Use fixed-width int32_t instead of platform-dependent int for binary layout consistency [incubator-graphar]

Posted by "yangxk1 (via GitHub)" <gi...@apache.org>.
yangxk1 commented on issue #809:
URL: https://github.com/apache/incubator-graphar/issues/809#issuecomment-3664402165

   I think at least the public struct/method of the public API should be included. Please check if these APIs need to be changed:
   [cpp/src/graphar/api](https://github.com/apache/incubator-graphar/blob/712b204df2aa625d233302a27bc83bd8affd2229/cpp/src/graphar/api). cc/ @Sober7135 @shivendra-dev54 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org
For additional commands, e-mail: commits-help@graphar.apache.org


Re: [I] feat(c++): Use fixed-width int32_t instead of platform-dependent int for binary layout consistency [incubator-graphar]

Posted by "Sober7135 (via GitHub)" <gi...@apache.org>.
Sober7135 commented on issue #809:
URL: https://github.com/apache/incubator-graphar/issues/809#issuecomment-3657028221

   > Thank you very much for your interest in it! I think it should be completely replaced. I also want to get your opinion [@Sober7135](https://github.com/Sober7135)
   
   I'm just sharing my opinion on scope:
   
   * I think "completely replaced" is: replace `int` **where it participates in a binary/layout contract** (on-disk / IPC / serialization, and any public API-facing structs/enums where a fixed 32/64-bit width is intended). It doesn’t need to mean replacing every local `int` inside function bodies. 
   
   * Also please don’t forget enums. For example, change this to `enum class Type : int32_t` / `uint32_t` 
   [https://github.com/apache/incubator-graphar/blob/bb4a1d335c9f8f50a534ccf08432b101aa493ae9/cpp/src/graphar/types.h#L39-L41](https://github.com/apache/incubator-graphar/blob/bb4a1d335c9f8f50a534ccf08432b101aa493ae9/cpp/src/graphar/types.h#L39-L41)
   
   * On `size_t`: it’s fine for in-memory sizes / public APIs / FFI (Rust side usually maps to `usize`), but it should not appear in on-disk / IPC / serialization layouts since its width is platform-dependent.
   
   CC @yangxk1 
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org
For additional commands, e-mail: commits-help@graphar.apache.org


Re: [I] feat(c++): Use fixed-width int32_t instead of platform-dependent int for binary layout consistency [incubator-graphar]

Posted by "yangxk1 (via GitHub)" <gi...@apache.org>.
yangxk1 commented on issue #809:
URL: https://github.com/apache/incubator-graphar/issues/809#issuecomment-3655989953

   Thank you very much for your interest in it! I think it should be completely replaced. I also want to get your opinion @Sober7135 
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org
For additional commands, e-mail: commits-help@graphar.apache.org


Re: [I] feat(c++): Use fixed-width int32_t instead of platform-dependent int for binary layout consistency [incubator-graphar]

Posted by "shivendra-dev54 (via GitHub)" <gi...@apache.org>.
shivendra-dev54 commented on issue #809:
URL: https://github.com/apache/incubator-graphar/issues/809#issuecomment-3656764555

   I didn’t find any remaining uses of platform-dependent int affecting binary
   layout. Existing int64_t usages appear intentional and consistent with Arrow
   APIs and large-graph support.
   
   I’ll hold off on changes unless there’s a specific area you’d like me to
   focus on or a case where narrowing is desired.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org
For additional commands, e-mail: commits-help@graphar.apache.org


Re: [I] feat(c++): Use fixed-width int32_t instead of platform-dependent int for binary layout consistency [incubator-graphar]

Posted by "yangxk1 (via GitHub)" <gi...@apache.org>.
yangxk1 commented on issue #809:
URL: https://github.com/apache/incubator-graphar/issues/809#issuecomment-3654649466

   #806 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org
For additional commands, e-mail: commits-help@graphar.apache.org


Re: [I] feat(c++): Use fixed-width int32_t instead of platform-dependent int for binary layout consistency [incubator-graphar]

Posted by "shivendra-dev54 (via GitHub)" <gi...@apache.org>.
shivendra-dev54 commented on issue #809:
URL: https://github.com/apache/incubator-graphar/issues/809#issuecomment-3656481556

   Quick clarification before I proceed further:
   
   For layout-sensitive fields, I see some offsets are stored as int64_t.
   Is this intentional due to Arrow compatibility and potential large graphs,
   or are there cases where int32_t is preferred when the value is guaranteed
   to fit in 32 bits?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org
For additional commands, e-mail: commits-help@graphar.apache.org


Re: [I] feat(c++): Use fixed-width int32_t instead of platform-dependent int for binary layout consistency [incubator-graphar]

Posted by "shivendra-dev54 (via GitHub)" <gi...@apache.org>.
shivendra-dev54 commented on issue #809:
URL: https://github.com/apache/incubator-graphar/issues/809#issuecomment-3655967297

   Hi! I’m interested in working on this enhancement.
   
   Before starting, I’d like to confirm the intended scope:
   – Should this change be limited to on-disk / IPC / serialization-facing structs only?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@graphar.apache.org
For additional commands, e-mail: commits-help@graphar.apache.org