summaryrefslogtreecommitdiff
path: root/example/macros.c
diff options
context:
space:
mode:
authorpryazha <pryadeiniv@mail.ru>2025-10-12 15:24:30 +0500
committerpryazha <pryadeiniv@mail.ru>2025-10-12 15:24:30 +0500
commit223b1056273f5d48d1c0bbfee75be7b82374d4eb (patch)
tree2b2003aad9c26af7006c5a5c7e2baf1a63ad89e7 /example/macros.c
parent7e73843ac5873833c707687cd0ada0a3034e600c (diff)
change identation, maybe will change back, add own gl functions loading, and glx example
Diffstat (limited to 'example/macros.c')
-rw-r--r--example/macros.c44
1 files changed, 0 insertions, 44 deletions
diff --git a/example/macros.c b/example/macros.c
deleted file mode 100644
index 0e836b0..0000000
--- a/example/macros.c
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "prb.h"
-#include <stdio.h>
-
-struct type {
- i32 i32_element;
- i16 i16_element;
- u8 u8_element;
-};
-
-#define nodes_count 10
-
-struct stack_node {
- i32 value;
- struct stack_node *next;
-};
-
-struct stack {
- struct stack_node *first;
- struct stack_node *last;
-};
-
-static void print_stack(struct stack s)
-{
- for (struct stack_node *node = s.first; node; node = node->next)
- printf("%d%s", node->value, ((node->next) ? " -> " : "\n"));
-}
-
-i32 main(void)
-{
- u64 offset = offsetof(struct type, u8_element);
- assert(offset == 6);
- info("offsetof(type_t, u8_element) = %lu", offset);
- info("stack:");
- struct stack_node nodes[nodes_count];
- struct stack stack = {0};
- for (i32 i = 0; i < array_count(nodes); ++i) {
- struct stack_node *node = nodes + i;
- node->value = i;
- sllpush(stack.first, stack.last, node);
- }
- print_stack(stack);
- sllpop(stack.first, stack.last);
- print_stack(stack);
-}