GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Embed Notice

HTML Code

Corresponding Notice

  1. Embed this notice
    anna (navi@social.vlhl.dev)'s status on Tuesday, 07-Nov-2023 08:02:00 JSTannaanna
    in reply to
    • UsernameSwift ☭ :verifiedaroace:
    • Pleroma-tan
    • Construction Worker

    @usernameswift @MercurialBuilding @kirby you don’t need to cast any pointer to/from void pointers actually.

    this is valid and generates no warnings with -Wall -Wpedantic -fanalyzer:

    #include <stdio.h> #include <stdlib.h> struct nya { int foo; int bar; }; void nya(void *mew) { struct nya *meow = mew; printf("%d, %d\n", meow->foo, meow->bar); } int main() { struct nya foo = { .foo = 5, .bar = 10 }; nya(&foo); return 0; }

    so not only malloc, realloc, and free, void* in general are exempt from casts

    (but do remember strict aliasing rules. you can’t put a type into a void pointer, and then turn it into another type)

    In conversationTuesday, 07-Nov-2023 08:02:00 JST from social.vlhl.devpermalink
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.