<p>You found it yourself, but basically the thing is that the C standard doesn't enforce much on pointer sizes.  The only (IIRC) thing that it requires is that a pointer to <code>void</code> can hold any other <em>data</em> pointer, and that a cast back to the original type yields the same pointer (and that <code>intptr_t</code> has the same kind of properties).  Anything further is implementation defined.</p>
<p>As said, in most common situations (your computer, mine, etc.), all pointers can be happily casted between different types back and forth, even function pointers.  But the C standard allows this not to be the case.<br>
The following <em>could</em> result in undefined behavior:</p>
<div class="highlight highlight-source-c"><pre><span class="pl-k">float</span> f1 = <span class="pl-c1">4</span>.<span class="pl-c1">2f</span>;
<span class="pl-k">float</span> *fp = &f1;
<span class="pl-k">int</span> *ip = (<span class="pl-k">int</span>*)fp;
<span class="pl-k">float</span> f2 = *((<span class="pl-k">float</span>*)ip);
<span class="pl-c"><span class="pl-c">//</span> whether f1 == f2 is implementation defined</span></pre></div>
<p>But again, as <a class="user-mention" data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=811085" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/elextr">@elextr</a> just said, we probably don't really have to worry about that.  And yeah things like <code>dlsym()</code> basically require <code>void*</code> to be able to hold a function pointer as well.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/geany/geany-plugins/issues/794#issuecomment-443010169">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABDrJxuE6ZqBU3YVHi49YX-GDQ6IvY-Sks5u0Fl5gaJpZM4Y5E1j">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABDrJy0HIy7sG_suNB86cVuGokpR4G3gks5u0Fl5gaJpZM4Y5E1j.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/geany/geany-plugins","title":"geany/geany-plugins","subtitle":"GitHub repository","main_image_url":"https://assets-cdn.github.com/images/email/message_cards/header.png","avatar_image_url":"https://assets-cdn.github.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/geany/geany-plugins"}},"updates":{"snippets":[{"icon":"PERSON","message":"@b4n in #794: You found it yourself, but basically the thing is that the C standard doesn't enforce much on pointer sizes.  The only (IIRC) thing that it requires is that a pointer to `void` can hold any other *data* pointer, and that a cast back to the original type yields the same pointer (and that `intptr_t` has the same kind of properties).  Anything further is implementation defined.\r\n\r\nAs said, in most common situations (your computer, mine, etc.), all pointers can be happily casted between different types back and forth, even function pointers.  But the C standard allows this not to be the case.\r\nThe following *could* result in undefined behavior:\r\n```C\r\nfloat f1 = 4.2f;\r\nfloat *fp = \u0026f1;\r\nint *ip = (int*)fp;\r\nfloat f2 = *((float*)ip);\r\n// whether f1 == f2 is implementation defined\r\n```\r\n\r\nBut again, as @elextr just said, we probably don't really have to worry about that.  And yeah things like `dlsym()` basically require `void*` to be able to hold a function pointer as well."}],"action":{"name":"View Issue","url":"https://github.com/geany/geany-plugins/issues/794#issuecomment-443010169"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/geany/geany-plugins/issues/794#issuecomment-443010169",
"url": "https://github.com/geany/geany-plugins/issues/794#issuecomment-443010169",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
},
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"hideOriginalBody": "false",
"originator": "AF6C5A86-E920-430C-9C59-A73278B5EFEB",
"title": "Re: [geany/geany-plugins] Scope breaks nightly with gcc 8 (#794)",
"sections": [
{
"text": "",
"activityTitle": "**Colomban Wendling**",
"activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png",
"activitySubtitle": "@b4n",
"facts": [

]
}
],
"potentialAction": [
{
"name": "Add a comment",
"@type": "ActionCard",
"inputs": [
{
"isMultiLine": true,
"@type": "TextInput",
"id": "IssueComment",
"isRequired": false
}
],
"actions": [
{
"name": "Comment",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"IssueComment\",\n\"repositoryFullName\": \"geany/geany-plugins\",\n\"issueId\": 794,\n\"IssueComment\": \"{{IssueComment.value}}\"\n}"
}
]
},
{
"name": "Close issue",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"IssueClose\",\n\"repositoryFullName\": \"geany/geany-plugins\",\n\"issueId\": 794\n}"
},
{
"targets": [
{
"os": "default",
"uri": "https://github.com/geany/geany-plugins/issues/794#issuecomment-443010169"
}
],
"@type": "OpenUri",
"name": "View on GitHub"
},
{
"name": "Unsubscribe",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"MuteNotification\",\n\"threadId\": 417615203\n}"
}
],
"themeColor": "26292E"
}
]</script>