Skip to content

added struct tags for all declared structs #173

Open
aalmkainzi wants to merge 1 commit into
stclib:mainfrom
aalmkainzi:container-structs-tags
Open

added struct tags for all declared structs #173
aalmkainzi wants to merge 1 commit into
stclib:mainfrom
aalmkainzi:container-structs-tags

Conversation

@aalmkainzi

Copy link
Copy Markdown
Contributor

This is so that declare_* macros work in C23 without needing i_declared.

For example, this code did not work because structs like the _iter and _result structs do not have tags, and what happens is the two declarations declare the same typedef name, but two anonymous structs, so they are not compatible. adding a tag fixes it, because in C23 re-declaring the same struct with the same tag is allowed.

#include "stc/types.h"

// vec
declare_vec(Vec, int);

#define T Vec, int
#include "stc/vec.h"

// list
declare_list(List, int);

#define T List, int
#include "stc/list.h"

// queue

declare_queue(Queue, int);

#define T Queue, int
#include "stc/queue.h"

// hashset

declare_hashset(Set, int);

#define T Set, int
#include "stc/hashset.h"

// sortedset

declare_sortedset(SortedSet, int);

#define T SortedSet, int
#include "stc/sortedset.h"

@nikita-edel

Copy link
Copy Markdown

not allowing the same typdef on the same struct name in any standard annoys me so damn much, like this useless restriction destroys so much potential

@nikita-edel

nikita-edel commented Jun 22, 2026

Copy link
Copy Markdown

i genuinly think i will stop writing c99 because of this stupid thing
and when im using c11(which doesnt solve this problem) and c23 might as well write c++
and c23 isnt even fully supported by msvc... CRAZY
edit:
anyways i still will use c23, LLVM + msvc is supported on windows

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

Successfully merging this pull request may close these issues.

3 participants