This commit is contained in:
balhau 2021-12-12 14:59:55 +00:00
parent be0b83f80f
commit 90128eb8e5
No known key found for this signature in database
GPG key ID: BE6343D39997BF6C
7 changed files with 17 additions and 37 deletions

View file

@ -1,5 +1,8 @@
#pragma once
#include <iostream>
#define DEBUG_MODE
#ifdef DEBUG_MODE

View file

@ -1,12 +1,5 @@
FIND_PACKAGE(GTK)
FIND_PACKAGE(GDK)
find_package(wxWidgets)
include(${wxWidgets_USE_FILE})
IF(GTK_FOUND)
message(STATUS "GTK found compiling GUI apps")
ADD_DEFINITIONS(${GTK3_CFLAGS_OTHER})
ADD_EXECUTABLE(gtk1 gtk1.cpp)
INCLUDE_DIRECTORIES(${GTK_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(gtk1 ${GTK_LIBRARIES})
ELSE()
message(STATUS "GTK not found.")
ENDIF(GTK_FOUND)
add_executable(gui1 gui1.cpp)
target_link_libraries(gui1 PRIVATE ${wxWidgets_LIBRARIES})

View file

@ -1,23 +0,0 @@
// Include gtk
//#include <gtk/gtk.h>
#include <gtk-2.0/gdk/gdk.h>
#include <gtk-2.0/gtk/gtk.h>
static void on_activate (GtkApplication *app) {
// Create a new window
GtkWidget *window = gtk_application_window_new (app);
// Create a new button
GtkWidget *button = gtk_button_new_with_label ("Hello, World!");
// When the button is clicked, close the window passed as an argument
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_close), window);
gtk_window_set_child (GTK_WINDOW (window), button);
gtk_window_present (GTK_WINDOW (window));
}
int main (int argc, char *argv[]) {
// Create a new application
GtkApplication *app = gtk_application_new ("com.example.GtkApplication",
G_APPLICATION_FLAGS_NONE);
g_signal_connect (app, "activate", G_CALLBACK (on_activate), NULL);
return g_application_run (G_APPLICATION (app), argc, argv);
}

View file

@ -1 +1,2 @@
add_subdirectory(memory)
add_subdirectory(dec)

View file

@ -1,2 +1,4 @@
add_executable(memorymodel model.cpp)
add_executable(volatile volatile.cpp)
add_executable(cmem cmem.c)
add_executable(cautofree cautofree.c)

View file

@ -1,9 +1,11 @@
#include "../../../include/misc/memory/model.h"
#include "../../../include/misc/util/debug.h"
#include <memory>
#include <atomic>
#define UPtr std::unique_ptr
#define SPtr std::shared_ptr
#define Atomic std::atomic
template <typename Object>
Box<Object>::Box(Object *ref)
@ -95,5 +97,7 @@ int main(void)
printBoxContent(box1);
Box<Point2D<int>> box2=box1;
printBoxContent(box2);
Atomic<int> atomic_int(12);
return 0;
}

View file

@ -3,7 +3,7 @@
inline unsigned long getTimestamp(){
unsigned hi,lo;
asm ("rdtsc": "=a" (lo), "=d" (hi) );
return ((unsigned long) lo )| ((unsigned long) hi << 32);
return ((unsigned long) lo ) | ((unsigned long) hi << 32);
}
inline unsigned long getTimestampVolatile(){