fork download
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <stddef.h>
  4. #include <unistd.h>
  5. #include <string.h>
  6. #include <inttypes.h>
  7.  
  8. #define setarr(a) [sizeof(a)-1] = (a) // remove NULL from end of string
  9.  
  10. // Осторожно, говномакросы
  11.  
  12. #define assign_1(a,begin)\
  13. {\
  14.   typeof (begin) m_cnt = begin;\
  15.   a = (typeof (a))(*m_cnt);\
  16. }\
  17.  
  18. #define assign_2(a,b,begin)\
  19. {\
  20.   typeof (begin) m_cnt = begin;\
  21.   a = (typeof (a))(m_cnt);\
  22.   m_cnt += sizeof(a);\
  23.   b = (typeof (b))(m_cnt);\
  24. }\
  25.  
  26. #define assign_3(a,b,c,begin)\
  27. {\
  28.   typeof (begin) m_cnt = begin;\
  29.   a = (typeof (a))(m_cnt);\
  30.   m_cnt += sizeof(a);\
  31.   b = (typeof (b))(m_cnt);\
  32.   m_cnt += sizeof(b);\
  33.   b = (typeof (c))(m_cnt);\
  34. }\
  35.  
  36.  
  37.  
  38. void I_print(void* data)
  39. {
  40. size_t* s_sz; // = data;
  41. uint8_t* s_data; // = data+sizeof(*s_sz);
  42. assign_2(s_sz,s_data,data)
  43. write(1, s_data, *s_sz);
  44. }
  45.  
  46. void* I_pr[1000];
  47. void** I_pr_ptr = I_pr;
  48.  
  49. int main(void)
  50. {
  51. const uint8_t word setarr("Hello, World\n");
  52. void* a = malloc(sizeof(size_t) +
  53. sizeof(uint8_t)*sizeof(word) );
  54. {
  55. size_t* tmp = a;
  56. *tmp = sizeof(word);
  57. }
  58.  
  59. memcpy (a+(sizeof(size_t)), word, sizeof(word));
  60.  
  61.  
  62. I_print(a);
  63. return 0;
  64. }
  65.  
Success #stdin #stdout 0s 1964KB
stdin
Standard input is empty
stdout
Hello, World