This file contains hidden or 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
/** | |
* Tests different type of initializers in jvm: | |
* 1) <clinit>: stands for class or the static initializer, called only once on the first reference of the class name. | |
* 2) <init>: is the class object initializer or the instance initializer called whenever creating a new object and it resembles the class constructor. | |
* | |
* @author pavl_g | |
*/ | |
public class TestInitializers { | |
static class TestClassInitializer { | |
public static int len = 00; |
This file contains hidden or 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<stdio.h> | |
#include<stdlib.h> | |
typedef struct { | |
void* start_address; | |
void* end_address; | |
size_t offset; | |
size_t size; | |
size_t pointer_location; |
This file contains hidden or 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<stdio.h> | |
#include<stdlib.h> | |
typedef struct { | |
void* start_address; | |
void* end_address; | |
size_t offset; | |
size_t size; | |
size_t pointer_location; |
This file contains hidden or 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
/** | |
* Test chunk memcpy | |
* | |
* @author pavl_g | |
*/ | |
#include <stdio.h> | |
#include <string.h> | |
static inline void printAddresses(char* arr, int length) { | |
for (int i = 0; i < length; i++) { |
This file contains hidden or 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 <stdio.h> | |
#include <stdlib.h> | |
/** jni.h **********************************************************************************/ | |
struct JNINativeInterface_ { | |
void *reserved0; | |
void *reserved1; | |
void *reserved2; | |
void *reserved3; |
This file contains hidden or 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 <stdio.h> | |
static inline void call_stack() { | |
void inside_block() { | |
printf("inside block"); | |
} | |
inside_block(); | |
} | |
int main() { |
This file contains hidden or 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 <stdio.h> | |
/** | |
* Finds the maximum number between 2 numbers. | |
* | |
* @param n0 the first operand | |
* @param n1 the second operand | |
* @return the maximum number, any of the 2 numbers if the numbers are equal | |
*/ | |
static inline int max0(int n0, int n1) { |
This file contains hidden or 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 <stdio.h> | |
int main(void) { | |
int x = 8; // define x | |
int y; // define y | |
// constant location (pointer) to non-constant data | |
int* const ptr = &x; | |
// an attempt to modifiy the data will succeed | |
*ptr = 55; | |
printf("%d\n", x); | |
// an attempt to modify the memory location will fail |
This file contains hidden or 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 <stdio.h> | |
int main(void) { | |
int x = 8; // define x | |
int y; // define y | |
// constant pointer to constant data | |
const int* const ptr = &x; | |
printf("%d\n", x); | |
} |
This file contains hidden or 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 <stdio.h> | |
#include <stdlib.h> | |
/** | |
* Headers | |
*/ | |
struct JNINativeInterface_ { | |
void *reserved0; | |
void *reserved1; | |
void *reserved2; |