You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@corinthia.apache.org by "Peter Kelly (JIRA)" <ji...@apache.org> on 2015/03/03 16:00:34 UTC

[jira] [Commented] (COR-50) Cast from pointer to integer of different size

    [ https://issues.apache.org/jira/browse/COR-50?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14345187#comment-14345187 ] 

Peter Kelly commented on COR-50:
--------------------------------

Looks good.

Although the casting of a 64-bit pointer to a 32-bit integer will occur on a 64-bit system, it's not an issue in this case as the relevant line of code is simply checking that the value of a multiple of 8, so this will not affect the result of the check.

Incidentally, this happens to be the one place in the codebase where we *do* have a custom memory allocator. DFAllocator is used for Node objects; within the context of a DFDocument object, all Nodes are allocated on the same "heap" (our custom data structure), and then freed in one go. This was done for performance reasons, to avoid the need to do a tree traversal and free many thousands of individual pointers when destroying a document.

> Cast from pointer to integer of different size
> ----------------------------------------------
>
>                 Key: COR-50
>                 URL: https://issues.apache.org/jira/browse/COR-50
>             Project: Corinthia
>          Issue Type: Bug
>          Components: DocFormats - core
>    Affects Versions: 0.5
>            Reporter: Gabriela Gibson
>            Priority: Minor
>         Attachments: DFalloc.patch, dfalloc.logmesg
>
>
> Compiler warning when compiling on a 32 bit system with gcc:
> In file included from /home/g/cor2/incubator-corinthia/DocFormats/core/src/lib/DFAllocator.c:21:0:
> /home/g/cor2/incubator-corinthia/DocFormats/core/src/lib/DFAllocator.c: In function ‘DFAllocatorAlloc’:
> /home/g/cor2/incubator-corinthia/DocFormats/core/src/lib/DFAllocator.c:80:14: warning: cast from pointer to i\
> nteger of different size [-Wpointer-to-int-cast]
>      assert((((unsigned long long)mem) % 8) == 0);



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)