Skip to content
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

"Coming-from" language tips #286

Open
3 of 13 tasks
Sobeston opened this issue Dec 28, 2024 · 1 comment
Open
3 of 13 tasks

"Coming-from" language tips #286

Sobeston opened this issue Dec 28, 2024 · 1 comment

Comments

@Sobeston
Copy link
Owner

Recently added support for custom show/hide admonitions for other programming languages.

Here's one found on the Slices page:

image

Occasional narrow comparisons for other languages, or additional context for people coming from specific languages, may be very useful for some. Feel free to suggest more in this issue.

  • Go

    • slices: comparison
  • C++

    • arraylist: ~= std::vector
    • comptime: vs constexpr/consteval
    • errors: vs exceptions
  • JS

    • assignment: "undefined" isn't the same
  • C

    • comptime: comptime vs macros / converting macros to comptime
    • single-item pointers: strictly single-item
    • imports: vs include / note on code guards & circular references
    • allocators: compare with c_allocator and malloc/free
  • Rust

    • switches: comparison with match
    • enums: comparison
    • errors: comparison
    • optionals: comparison

    related:
    Zig for C++ programmers #65
    Zig for C Programmers (proposal for new chapter) #46

@Sobeston Sobeston pinned this issue Dec 28, 2024
@kassane
Copy link

kassane commented Dec 28, 2024

I don't know if you want to add to this guide, how to create basic custom allocator, like c_allocator/raw_c_allocator (more simple) - using std.mem.Allocator.

The example below shows a minimal version of both interfaces for custom allocators.

  • C++17 (std::pmr::memory_resource),
  • Rust (std::alloc::GlobalAlloc)

https://github.com/kassane/zig-gpa-ffi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants