並び順

ブックマーク数

期間指定

  • から
  • まで

1 - 23 件 / 23件

新着順 人気順

c function pointer typedef exampleの検索結果1 - 23 件 / 23件

  • Writing a C compiler in 500 lines of Python

    A few months ago, I set myself the challenge of writing a C compiler in 500 lines of Python1, after writing my SDF donut post. How hard could it be? The answer was, pretty hard, even when dropping quite a few features. But it was also pretty interesting, and the result is surprisingly functional and not too hard to understand! There's too much code for me to comprehensively cover in a single blog

    • Making a 3D Modeler, in C, in a Week

      Last fall I participated in a week long programming event called the Wheel Reinvention Jam. The point of the Jam was to revisit existing software systems with fresh eyes. I ended up making a 3D modeler called “ShapeUp”. This post will make more sense if you watch the video demo of ShapeUp before reading more. You can try ShapeUp in your browser. This is what it looks like: Mike Wazowski modeled in

        Making a 3D Modeler, in C, in a Week
      • gist:3ef8747868ac126c30f94888425eb56d

        gistfile1.md yjit についてメモ書き MRI に組み込まれた JIT 実装 Shopify で Maxime Chevalier-Boisvert さんが中心となり開発された 日本語だと https://techracho.bpsinc.jp/hachi8833/2021_11_02/112909 が詳しい めちゃ速い $ for opt in '' '--jit' '--yjit'; do echo "opt": $opt; time ./miniruby $opt -e 'def fib(n); return n if n < 2; fib(n - 1) + fib(n-2); end; fib(35)'; done opt: real 0m1.050s user 0m0.971s sys 0m0.036s opt: --jit real 0m0.755s user 0

          gist:3ef8747868ac126c30f94888425eb56d
        • Learn x86-64 assembly by writing a GUI from scratch

          We then pass the address on the stack of the beginning of the string to the write syscall, as well as its length: %define SYSCALL_WRITE 1 %define STDOUT 1 print_hello: push rbp ; Save rbp on the stack to be able to restore it at the end of the function. mov rbp, rsp ; Set rbp to rsp sub rsp, 5 ; Reserve 5 bytes of space on the stack. mov BYTE [rsp + 0], 'h' ; Set each byte on the stack to a string

          • Introducing the WebAssembly JavaScript Promise Integration API · V8

            The JavaScript Promise Integration (JSPI) API allows WebAssembly applications that were written assuming synchronous access to external functionality to operate smoothly in an environment where the functionality is actually asynchronous. This note outlines what the core capabilities of the JSPI API are, how to access it, how to develop software for it and offers some examples to try out. What is ‘

            • The OpenSSL punycode vulnerability (CVE-2022-3602): Overview, detection, exploitation, and remediation | Datadog Security Labs

              emerging threats and vulnerabilities The OpenSSL punycode vulnerability (CVE-2022-3602): Overview, detection, exploitation, and remediation November 1, 2022 emerging vulnerability On November 1, 2022, the OpenSSL Project released a security advisory detailing a high-severity vulnerability in the OpenSSL library. Deployments of OpenSSL from 3.0.0 to 3.0.6 (included) are vulnerable and are fixed in

                The OpenSSL punycode vulnerability (CVE-2022-3602): Overview, detection, exploitation, and remediation | Datadog Security Labs
              • 0.8.0 Release Notes ⚡ The Zig Programming Language

                Tier 4 Support § Support for these targets is entirely experimental. If this target is provided by LLVM, LLVM may have the target as an experimental target, which means that you need to use Zig-provided binaries for the target to be available, or build LLVM from source with special configure flags. zig targets will display the target if it is available. This target may be considered deprecated by

                • Simply Parse in C

                  by Chloe Kudryavtsev People are terrified of parsers and parsing. To the point of using magical libraries with custom syntaxes to learn just to get started. In the hopes of completely shattering this preconception, I will write a parser for the “ini” file format in about 150 lines of pure and readable ISO C99. Furthermore, this parser will be something that's nice to use and has error correcting f

                    Simply Parse in C
                  • Understanding the Heap - a beautiful mess

                    In this blog, I am going to explain the important concepts of Heap and use the ptmalloc in the Glibc 2.31 library as an example. The heap is a beautiful mess :) I really like the saying shown above. The word Heap we always use refers to the dynamically allocated segment in the virtual memory space of a process, but it actually stands for the implementation of the memory pool(the dynamic memory all

                    • 0.10.0 Release Notes ⚡ The Zig Programming Language

                      Tier 4 Support § Support for these targets is entirely experimental. If this target is provided by LLVM, LLVM may have the target as an experimental target, which means that you need to use Zig-provided binaries for the target to be available, or build LLVM from source with special configure flags. zig targets will display the target if it is available. This target may be considered deprecated by

                      • Rust for Secure IoT Applications: Why C Is Getting Rusty

                        www.embedded-world.eu Rust for Secure IoT Applications Why C Is Getting Rusty Mario Noseda, Fabian Frei, Andreas Rüst, Simon Künzli Zurich University of Applied Sciences (ZHAW) Institute of Embedded Systems (InES) Winterthur, Switzerland mario.noseda@zhaw.ch, fabian.frei@zhaw.ch, andreas.ruest@zhaw.ch, simon.kuenzli@zhaw.ch Abstract— Memory corruption is still the most used type of exploit in toda

                        • V8 Torque user manual · V8

                          V8 Torque is a language that allows developers contributing to the V8 project to express changes in the VM by focusing on the intent of their changes to the VM, rather than preoccupying themselves with unrelated implementation details. The language was designed to be simple enough to make it easy to directly translate the ECMAScript specification into an implementation in V8, but powerful enough t

                          • Lesser known tricks, quirks and features of C

                            Mini-post: Digraphs and Trigraphs | ENOSUCHBLOG C alternative tokens - Wikipedia Why are there digraphs in C and C++? - Stack Overflow Purpose of Trigraph sequences in C++? A brief description of Normative Addendum 1 Designated initializer # These allow you to specify which elements of an object (array, structure, union) are to be initialized by the values following. The order does not matter! str

                            • Making LLVM GEP safer in Haskell

                              In today's article, I will showcase how Haskell's typesystem can be used to simplify code generation and reduce the chance of bugs involving the LLVM getelementptr instruction. Intro to the GEP instruction LLVM as a compiler framework offers many different low-level instructions, one of which being the getelementptr instruction (commonly abbreviated as just "gep"). With gep, you can compute derive

                                Making LLVM GEP safer in Haskell
                              • cuneicode, and the Future of Text in C

                                Following up from the last post, there is a lot more we need to cover. This was intended to be the post where we talk exclusively about benchmarks and numbers. But, I have unfortunately been perfectly taunted and status-locked, like a monster whose “aggro” was pulled by a tank. The reason, of course, is due to a few folks taking issue with my outright dismissal of the C and C++ APIs (and not showi

                                  cuneicode, and the Future of Text in C
                                • Python behind the scenes #6: how Python object system works

                                  As we know from the previous parts of this series, the execution of a Python program consists of two major steps: The CPython compiler translates Python code to bytecode. The CPython VM executes the bytecode. We've been focusing on the second step for quite a while. In part 4 we've looked at the evaluation loop, a place where Python bytecode gets executed. And in part 5 we've studied how the VM ex

                                  • Decoding UTF8 with Parallel Extract

                                    Decoding UTF8 with Parallel Extract 23 Mar 2024 As a side-quest I recently decided to write a branchless utf8 decoder utilizing the pext or "parallel extract" instruction. It's compliant with rfc-3629, meaning that it doesn't just naively decode the code-point but also checks for overlong encoding, surrogate pairs and such. Compiled with gcc -O3 -march=x86-64-v3 the entire decoder results in just

                                    • Pointers Are Complicated III, or: Pointer-integer casts exposed

                                      Pointers Are Complicated III, or: Pointer-integer casts exposed In my previous blog post on pointer provenance, I have shown that not thinking carefully about pointers can lead to a compiler that is internally inconsistent: programs that are intended to be well-behaved get miscompiled by a sequence of optimizations, each of which seems intuitively correct in isolation. We thus have to remove or at

                                      • Abstract Syntax Tree: An Example in C

                                        In a previous blog post, we looked at a simple one-pass compiler written in C. Now, let’s look at how we can design an abstract syntax tree and work with it. An abstract syntax tree (or an AST) is a tree-shaped representation of source code that is convenient for a compiler to operate. A compiler might represent an expression like 4 + 2 * 10 + 3 * (5 + 1) using a tree structure like this: Figure 1

                                        • Rust and dynamically-sized thin pointers

                                          One of Rust's notable differences from C is its requirement that all values have a defined size, which enables runtime bounds-checking and advanced static analysis tooling such as MIRI. For dynamically-sized types (DSTs) this requirement is implemented using thick pointers, such that each pointer to a dynamically-sized value is an (address, size) tuple. Thick pointers are more convenient and easie

                                          • C++ exceptions under the hood

                                            Index A tiny ABI An ABI to appease the linker Catching what you throw Magic around __cxa_begin_catch and __cxa_end_catch Gcc_except_table and the personality function A nice personality Two-phase handling Catching our first exception _Unwind_ and call frame info Reading a CFI table And suddenly, reflexion in C++ Setting the context for a landing pad Multiple landing pads & the teachings of the gur

                                              C++ exceptions under the hood
                                            • Following up on the Python JIT

                                              Performance of Python programs has been a major focus of development for the language over the last five years or so; the Faster CPython project has been a big part of that effort. One of its subprojects is to add an experimental just-in-time (JIT) compiler to the language; at last year's PyCon US, project member Brandt Bucher gave an introduction to the copy-and-patch JIT compiler. At PyCon US 20

                                              • Rust panics under the hood, and implementing them in .NET

                                                Rust panics under the hood, and implementing them in .NET I am currently working on a Rust to .NET compiler, rustc_codegen_clr. To get it to work, I need to implement many Rust features using .NET APIs. One of such features is panicking and unwinding. This article is the first one in a series about Rust panics, unwinding, and my implementation of them in .NET. In this part, I will look at unwindin

                                                1