Last active
March 11, 2019 11:12
-
-
Save electroCutie/55af3f9b0ca95487c1f4e5d1c9ddb94f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#include <stdio.h> | |
#include <printf.h> | |
#define _stride(_type) ({ \ | |
_type* _t = (_type*) 0; \ | |
(uint64_t) (_t+1); \ | |
}) | |
struct st { | |
char c; | |
double d; | |
}; | |
int main(){ | |
printf("%lu\n", _stride(char)); | |
printf("%lu\n", _stride(int)); | |
printf("%lu\n", _stride(long)); | |
printf("%lu\n", _stride(unsigned long long)); | |
printf("%lu\n", _stride(float)); | |
printf("%lu\n", _stride(double)); | |
printf("%lu\n", _stride(struct st)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment