Skip to content

Instantly share code, notes, and snippets.

View ctor_init_list_fallacy.cpp
#include <stdio.h>
class Component
{
public:
int value;
Component(int v) :
value(v)
{
@martinky
martinky / Makefile
Last active Oct 2, 2019
Makefile used to run complete Ansible playbooks in parallel on individual hosts using make -jN with added timeout constraint.
View Makefile
HOSTS=host_a host_b
INVENTORY=../data/inventory.inv
PLAYBOOK=../playbooks/test.yml
TIMEOUT=600
deploy: all_hosts
all_hosts: $(HOSTS)
$(HOSTS):
@martinky
martinky / QML_JS_closure_bug.pro
Last active Mar 26, 2020
Minimal example simulating a JS closure capture bug of the QML engine that is only observed while the QML debugger is attached. With the QML debugger attached following error occurs: main.qml:30: ReferenceError: text is not defined. Without QML debugger attached, the code works properly.
View QML_JS_closure_bug.pro
QT += quick
CONFIG += c++11
DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += main.cpp
RESOURCES += qml.qrc
@martinky
martinky / dummy.h
Last active Mar 23, 2021
Dummy helper struct that helps to debug when C++ objects get created, copied and destroyed.
View dummy.h
#pragma once
/*
Dummy struct that prints a line whenever it is constructed, copied, moved or destructed.
*/
struct dummy {
int val;
dummy() : val(0) { printf("dummy() def ctor\n"); }
dummy(int v) : val(v) { printf("dummy(%d) ctor\n", val); }
dummy(const dummy &d) : val(d.val) { printf("dummy(%d) copy ctor\n", val); }