These are chat archives for caryll/otfcc

Nov 2016
Belleve Invis
Nov 07 2016 09:08
@schriftgestalt Georg, should I make a “vector” type (in C) that is capable to use [ ] directly?
Something like SDS, a header at the “left” of the pointer you have.
Georg Seifert
Nov 07 2016 10:12
I dont reaylly understand. You mean a type where one can access elements with var[index]?
Belleve Invis
Nov 07 2016 10:13
@schriftgestalt Yes, like a C++ std::vector, in C, with ability to use var[index] directly.
Use some trick in SDS string (or some MFC string), it is possible.
there will be two “types”: SDAHandle(T) and SDA(T), SDAHandle(T) is a struct with a zero-length array at its end, and the SDA(T) refers to a pointer points to the beginning of that array.
Belleve Invis
Nov 07 2016 10:19
#define SDAHandle(T) struct {
    ElementInfo __ei;
    size_t length;
    size_t capacity;
    T elements[];
#define SDA(T) T*
Belleve Invis
Nov 07 2016 10:28
typedef SDAHandle(void) SDAHandle_Void;
#define __SDAHDROF(x) ((SDAHandle_Void*)((void*)(x) - (sizeof(SDAHAndle_Void))))
``C#define __SDAHDROF(x) ((SDAHandle_Void*)((void*)(x) - (sizeof(SDAHAndle_Void))))
#define __SDAHDROF(x) ((SDAHandle_Void*)((char*)(x) - (sizeof(SDAHAndle_Void))))