doc_id
stringlengths
36
36
metadata
dict
input
stringlengths
28
4.3k
output
stringlengths
11
5.45k
fbc11dad-59fc-4642-aa60-d3b486083b3c
{ "language": "C++" }
```c++ #include "Halide.h" #include <stdio.h> #include <thread> using namespace Halide; int main(int argc, char **argv) { // Test if the compiler itself is thread-safe. This test is // intended to be run in a thread-sanitizer. std::vector<std::thread> threads; for (int i = 0; i < 1000; i++) { ...
```c++ #include "Halide.h" #include <stdio.h> #include <future> using namespace Halide; static std::atomic<int> foo; int main(int argc, char **argv) { // Test if the compiler itself is thread-safe. This test is // intended to be run in a thread-sanitizer. std::vector<std::future<void>> futures; for (...
15e0c5b5-3c7d-46f1-9176-85bd99f5ba73
{ "language": "C++" }
```c++ /* * ty, a collection of GUI and command-line tools to manage Teensy devices * * Distributed under the MIT license (see LICENSE.txt or http://opensource.org/licenses/MIT) * Copyright (c) 2015 Niels Martignène <niels.martignene@gmail.com> */ #include <QSettings> #include "database.hh" using namespace std;...
```c++ /* * ty, a collection of GUI and command-line tools to manage Teensy devices * * Distributed under the MIT license (see LICENSE.txt or http://opensource.org/licenses/MIT) * Copyright (c) 2015 Niels Martignène <niels.martignene@gmail.com> */ #include <QSettings> #include "database.hh" using namespace std;...
3096d0e8-356a-47c8-abe1-8f9f8e8bb96e
{ "language": "C++" }
```c++ #include "MainWindow.h" #include <Application.h> #include <Menu.h> #include <MenuItem.h> #include <View.h> #include "MainView.h" MainWindow::MainWindow(void) : BWindow(BRect(100,100,500,400),"Font Demo", B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS) { BRect r(Bounds()); r.bottom = 20; fMenuBar = new B...
```c++ #include "MainWindow.h" #include <Application.h> #include <Menu.h> #include <MenuItem.h> #include <View.h> #include "MainView.h" MainWindow::MainWindow(void) : BWindow(BRect(100, 100, 900, 550),"Font Demo", B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS) { BRect r(Bounds()); r.bottom = 20; fMenuBar = ne...
a899af7e-4484-4444-a63f-5498790a65e9
{ "language": "C++" }
```c++ // Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "cc/blink/web_external_bitmap_impl.h" #include "cc/resources/shared_bitmap.h" namespace cc_blink { namespace { SharedBitmapAllocationF...
```c++ // Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "cc/blink/web_external_bitmap_impl.h" #include "cc/resources/shared_bitmap.h" namespace cc_blink { namespace { SharedBitmapAllocationF...
f82ff5e6-7007-42c6-8c62-994846a3bbbb
{ "language": "C++" }
```c++ // Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // This is a simple allocator based on the windows heap. extern "C" { HANDLE win_heap; bool win_heap_init(bool use_lfh) { win_heap = HeapC...
```c++ // Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // This is a simple allocator based on the windows heap. extern "C" { HANDLE win_heap; bool win_heap_init(bool use_lfh) { win_heap = HeapC...
10c67466-7015-4537-9dd5-def98b62565f
{ "language": "C++" }
```c++ #include "yugong.hpp" #include <cstdint> #include <cstdlib> namespace yg { void YGStack::alloc(YGStack &stack, uintptr_t size) { void *mem = std::malloc(size); uintptr_t start = (uintptr_t)mem; stack.start = start; stack.size = size; stack.sp = start + size; } ...
```c++ #include "yugong.hpp" #include <cstdint> #include <cstdlib> namespace yg { void YGStack::alloc(YGStack &stack, uintptr_t size) { void *mem = std::malloc(size); uintptr_t start = reinterpret_cast<uintptr_t>(mem); stack.start = start; stack.size = size; stack.sp = st...
920a674a-0bb7-479b-8084-3a6570c592b6
{ "language": "C++" }
```c++ #define BOOST_TEST_MODULE rainback #include "init.hpp" #include <QApplication> struct QApplicationFixture { int argc; char name[100]; char* argv[1]; QApplication* app; public: QApplicationFixture() : argc(1) { strcpy(name, "rainback"); argv[0] = name; ap...
```c++ #define BOOST_TEST_MODULE rainback #include "init.hpp" #include <QCoreApplication> struct QApplicationFixture { int argc; char name[100]; char* argv[1]; QCoreApplication* app; public: QApplicationFixture() : argc(1) { strcpy(name, "rainback"); argv[0] = name; ...
62b1ee37-56e5-469f-96b0-8483e154ed4b
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -fsyntax-only -verify %s // RUN: %clang_cc1 -fsyntax-only -verify -fshort-wchar %s #include <limits.h> const bool swchar = (wchar_t)-1 > (wchar_t)0; #ifdef __WCHAR_UNSIGNED__ int signed_test[!swchar]; #else int signed_test[swchar]; #endif int max_test[WCHAR_MAX == (swchar ? -(WCHAR_MIN+1) ...
```c++ // RUN: %clang -fsyntax-only -verify %s // RUN: %clang -fsyntax-only -verify -fshort-wchar %s #include <limits.h> const bool swchar = (wchar_t)-1 > (wchar_t)0; #ifdef __WCHAR_UNSIGNED__ int signed_test[!swchar]; #else int signed_test[swchar]; #endif int max_test[WCHAR_MAX == (swchar ? -(WCHAR_MIN+1) : (wchar...
4a5c7e66-1b1f-4a17-bfc5-a8f9faf69d7a
{ "language": "C++" }
```c++ #include <libclientserver.h> Thread::Thread() { m_IsRunning = false; m_IsDetached = false; } Thread::~Thread() { if (IsRunning()) Stop(); } void Thread::Start() { m_IsRunning = true; if (pthread_create(&m_thread, NULL, RunInternal, this) != 0) abort(); } void Thread::Stop() { #ifdef DEBUG if (I...
```c++ #include <libclientserver.h> Thread::Thread() { m_IsRunning = false; m_IsDetached = false; } Thread::~Thread() { if (IsRunning()) Stop(); } void Thread::Start() { m_IsRunning = true; if (pthread_create(&m_thread, NULL, RunInternal, this) != 0) abort(); } void Thread::Stop() { #ifdef DEBUG if (I...
d53ad233-8b84-4a4c-bbb9-90e1681978d1
{ "language": "C++" }
```c++ #include "hotkey.h" #include "ui_hotkey.h" hotkey::hotkey(QWidget *parent) : s(s), QWidget(parent), ui(new Ui::hotkey) { ui->setupUi(this); } hotkey::~hotkey() { delete ui; } void hotkey::keyPressEvent(QKeyEvent *event) { int uKey = event->key(); Qt::Key key = static_cast<Qt::Key>(...
```c++ #include "hotkey.h" #include "ui_hotkey.h" hotkey::hotkey(QWidget *parent) : s(s), QWidget(parent), ui(new Ui::hotkey) { ui->setupUi(this); } hotkey::~hotkey() { delete ui; } void hotkey::keyPressEvent(QKeyEvent *event) { int uKey = event->key(); Qt::Key key = static_cast<Qt::Key>(...
01092752-392c-42aa-8005-0d7ce882a751
{ "language": "C++" }
```c++ #include "box.hpp" Box::Box(): // default constructor min_{0.0, 0.0, 0.0}, max_{0.0, 0.0, 0.0} {} Box::Box(Box const& b): // copy constructor min_{b.min_}, max_{b.max_} {} Box::Box(Box&& b): // move constructor Box() { swap(*this,...
```c++ #include "box.hpp" Box::Box(): // default constructor min_{0.0, 0.0, 0.0}, max_{0.0, 0.0, 0.0} {} Box::Box(Box const& b): // copy constructor min_{b.min_}, max_{b.max_} {} Box::Box(Box&& b): // move constructor Box() { swap(*this,...
8d79de93-248b-4eca-a2f9-65e69f57361e
{ "language": "C++" }
```c++ /********************************************************************** * * GEOS - Geometry Engine Open Source * http://geos.osgeo.org * * Copyright (C) 2012 Sandro Santilli <strk@keybit.net> * * This is free software; you can redistribute and/or modify it under * the terms of the GNU Lesser General Publ...
```c++ /********************************************************************** * * GEOS - Geometry Engine Open Source * http://geos.osgeo.org * * Copyright (C) 2012 Sandro Santilli <strk@keybit.net> * * This is free software; you can redistribute and/or modify it under * the terms of the GNU Lesser General Publ...
11862b24-067c-42d7-901f-f48a850678ae
{ "language": "C++" }
```c++ #include <X11/keysym.h> #include "grid.hpp" #include "thumbnail_manager.hpp" #include "x_connection.hpp" #include "x_client_chooser.hpp" #include "x_client_thumbnail_gl.hpp" int main(int argc, char ** argv) { xcb_keysym_t east_key = XK_l; xcb_keysym_t west_key = XK_h; xcb_keysym_t north_key = XK_k; xcb...
```c++ #include <signal.h> #include <X11/keysym.h> #include "grid.hpp" #include "thumbnail_manager.hpp" #include "x_connection.hpp" #include "x_client_chooser.hpp" #include "x_client_thumbnail_gl.hpp" x_event_source_t * g_event_source = NULL; void sig_handler(int signum) { if (g_event_source) g_event_source->shutd...
76d3a9aa-5d62-47ab-a40e-5b33a527d54b
{ "language": "C++" }
```c++ // Solution to the TwoSum problem from LeetCode #include "two_sum.h" TwoSum::TwoSum() { } vector<int> TwoSum::solver(vector<int>& nums, int target) { for(int i=0; i<nums.size(); i++) { for(int j=0; j<nums.size(); j++) { int value = nums[i] + nums[j]; if ((value == target) && (i != j)) {...
```c++ // Solution to the TwoSum problem from LeetCode #include "two_sum.h" TwoSum::TwoSum() { } vector<int> TwoSum::solver(vector<int>& nums, int target) { for(int i=0; i<nums.size(); i++) { for(int j=0; j<nums.size(); j++) { int sum = nums[i] + nums[j]; if ((sum == target) && (i != j)) { // ...
6de9d36c-bf4a-44a1-b2ed-64540a80b622
{ "language": "C++" }
```c++ // Clang on MacOS can find libc++ living beside the installed compiler. // This test makes sure our libTooling-based tools emulate this properly with // fixed compilation database. // // RUN: rm -rf %t // RUN: mkdir %t // // Install the mock libc++ (simulates the libc++ directory structure). // RUN: cp -r %S/Inp...
```c++ // Clang on MacOS can find libc++ living beside the installed compiler. // This test makes sure our libTooling-based tools emulate this properly with // fixed compilation database. // // RUN: rm -rf %t // RUN: mkdir %t // // Install the mock libc++ (simulates the libc++ directory structure). // RUN: cp -r %S/Inp...
f1e01df8-518e-4c9b-ab35-b7e0cffa3058
{ "language": "C++" }
```c++ #include "logger.h" Logger::Level Logger::logLevel = Logger::Level::ERROR; void Logger::Error(std::string msg) { std::cerr << "[Error]: " << msg.c_str() << std::endl; } void Logger::Warn(std::string msg) { if (Logger::logLevel >= Logger::Level::WARN) { std::cout << "[Warn]: " << msg.c_str() << std::endl; ...
```c++ #include "logger.h" Logger::Level Logger::logLevel = Logger::Level::WARN; void Logger::Error(std::string msg) { std::cerr << "[Error]: " << msg.c_str() << std::endl; } void Logger::Warn(std::string msg) { if (Logger::logLevel >= Logger::Level::WARN) { std::cout << "[Warn]: " << msg.c_str() << std::endl; ...
6f5739fe-d990-413d-8031-369c1284cd22
{ "language": "C++" }
```c++ /* * Copyright (c) 1998-2005, Index Data. * See the file LICENSE for details. * * $Id: tstquery.cpp,v 1.2 2006-03-29 13:14:15 adam Exp $ */ #include <stdlib.h> #include <yazpp/z-query.h> using namespace yazpp_1; void tst1(const char *query_str_in, const char *query_expected) { Yaz_Z_Query q; q ...
```c++ /* * Copyright (c) 1998-2006, Index Data. * See the file LICENSE for details. * * $Id: tstquery.cpp,v 1.3 2006-07-07 12:57:15 adam Exp $ */ #include <stdlib.h> #include <yazpp/z-query.h> using namespace yazpp_1; void tst1(const char *query_str_in, const char *query_expected) { Yaz_Z_Query q; q ...
e5f14159-8982-40a0-ad03-5208599e0cca
{ "language": "C++" }
```c++ #include "board.hpp" #include "gtest/gtest.h" class BoardTest : public ::testing::Test { protected: BoardTest() : board_(1, 2) { } virtual ~BoardTest() { } virtual void SetUp() { } Quoridor::Board board_; }; TEST_F(BoardTest, set_size) { board_.set_size(10, 11); EXPECT_EQ(...
```c++ #include "board.hpp" #include "exception.hpp" #include "gtest/gtest.h" class BoardTest : public ::testing::Test { protected: BoardTest() : board_(1, 2) { } Quoridor::Board board_; }; TEST_F(BoardTest, ctor) { EXPECT_EQ(1, board_.row_num()); EXPECT_EQ(2, board_.col_num()); // test inval...
b57343e3-3b76-4a63-b494-eaec0e92450b
{ "language": "C++" }
```c++ /* * ============================================================================ * Filename: server_main.cc * Description: Server main for testing * Version: 1.0 * Created: 04/25/2015 06:37:53 PM * Revision: none * Compiler: gcc * Author: Rafael Gozlan, ...
```c++ /* * ============================================================================ * Filename: server_main.cc * Description: Server main for testing * Version: 1.0 * Created: 04/25/2015 06:37:53 PM * Revision: none * Compiler: gcc * Author: Rafael Gozlan, ...
028ae8f6-14f4-4109-8e87-006e242a1a66
{ "language": "C++" }
```c++ // FIXME: Disabled, appears to have undefined behavior, and needs to be updated to match new warnings. // RUN: clang-cc -fsyntax-only -verify %s // XFAIL: * namespace A { int VA; void FA() {} struct SA { int V; }; } using A::VA; using A::FA; using typename A::SA; void main() { VA = 1; FA()...
```c++ // RUN: clang-cc -fsyntax-only -verify %s // XFAIL: * namespace A { int VA; void FA() {} struct SA { int V; }; } using A::VA; using A::FA; using typename A::SA; int main() { VA = 1; FA(); SA x; //Still needs handling. } struct B { void f(char){}; void g(char){}; }; struct D ...
1b5c31b3-f76f-4606-8bf1-c506cb88ba94
{ "language": "C++" }
```c++ #include "stdafx.h" #include "CppUnitTest.h" #include "datastore.h" #include "transaction.h" #include "internal/operations/post_operation.h" #include "dummy_values.h" using Assert = Microsoft::VisualStudio::CppUnitTestFramework::Assert; namespace You { namespace DataStore { namespace UnitTests { TEST_CLASS(Da...
```c++ #include "stdafx.h" #include "CppUnitTest.h" #include "datastore.h" #include "transaction.h" #include "internal/operations/post_operation.h" #include "dummy_values.h" using Assert = Microsoft::VisualStudio::CppUnitTestFramework::Assert; namespace You { namespace DataStore { namespace UnitTests { TEST_CLASS(Da...
b4c4bcaf-ff73-4772-af76-d7149a3fefc2
{ "language": "C++" }
```c++ //===- llvm/unittest/IR/AttributesTest.cpp - Attributes unit tests --------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
```c++ //===- llvm/unittest/IR/AttributesTest.cpp - Attributes unit tests --------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
63e0e01b-b793-4c41-ab2e-bebe5a624ad4
{ "language": "C++" }
```c++ /** * Tests of str_rope and rope_node. * * @author Jean-Claude Paquin **/ #include <catch.hpp> #include <primitives/str_rope.h> TEST_CASE("Empty rope_node", "[rope_node]") { std::unique_ptr<rope_node> node = std::make_unique<rope_node>(); SECTION("Empty node has nullptr left & right") { RE...
```c++ /** * Tests of str_rope and rope_node. * * @author Jean-Claude Paquin **/ #include <catch.hpp> #include <primitives/str_rope.h> TEST_CASE("Empty rope_node", "[rope_node]") { std::unique_ptr<rope_node> node = std::make_unique<rope_node>(); SECTION("Empty node has nullptr left & right") { RE...
4dca2a65-30bf-41b0-aa7a-eaeae7f5a67f
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -g -S -masm-verbose -o - %s | FileCheck %s // CHECK: abbrev_begin: // CHECK: DW_AT_accessibility // CHECK-NEXT: DW_FORM_data1 class A { public: int p; private: int pr; }; A a; ``` Fix test case due to r196394 and improve it to not rely on LLVM code generation either.
```c++ // RUN: %clang -g -S -emit-llvm %s -o - | FileCheck %s // CHECK: [ DW_TAG_member ] [p] [{{[^]]*}}] [from int] // CHECK: [ DW_TAG_member ] [pr] [{{[^]]*}}] [private] [from int] class A { public: int p; private: int pr; }; A a; ```
7323b998-2204-43da-8729-3a0fcd1aaccc
{ "language": "C++" }
```c++ // RUN: %clang_cl_asan -O0 %s -Fe%t // RUN: echo "42" | %run %t 2>&1 | FileCheck %s #include <iostream> int main() { int i; std::cout << "Type i: "; std::cin >> i; return 0; // CHECK: Type i: // CHECK-NOT: AddressSanitizer: stack-buffer-overflow on address [[ADDR:0x[0-9a-f]+]] } ``` Add a test case fo...
```c++ // First, check this works with the default blacklist: // RUN: %clang_cl_asan -O0 %s -Fe%t // RUN: echo "42" | %run %t 2>&1 | FileCheck %s // // Then, make sure it still works when a user uses his own blacklist file: // RUN: %clang_cl_asan -O0 %s -fsanitize-blacklist=%p/../Helpers/initialization-blacklist.txt -F...
b70b3818-294f-414c-aab1-ad91cf7a6815
{ "language": "C++" }
```c++ #include <ionCore.h> #include <catch.hpp> TEST_CASE("ionStandardLibrary::String::Build") { REQUIRE(String::Build("") == string()); REQUIRE(String::Build("Test") == "Test"); REQUIRE(String::Build("Hello %d", 123) == "Hello 123"); REQUIRE(String::Build("%c %d %X %s", 'a', 42, 0xABCD, "foo") == "a ...
```c++ #include <ionCore.h> #include <catch.hpp> TEST_CASE("ionStandardLibrary::ConditionalMapAccess") { map<int, int *> Test; REQUIRE(! ConditionalMapAccess(Test, 0)); REQUIRE(! ConditionalMapAccess(Test, 1)); REQUIRE(! ConditionalMapAccess(Test, 2)); int X, Y; Test[0] = & X; Test[1] = & Y; ...
d7665639-fabe-4014-a43d-881e0a7e8194
{ "language": "C++" }
```c++ #include "ButtonEntity.h" ButtonEntity::ButtonEntity() { } ButtonEntity::~ButtonEntity() { } int ButtonEntity::Update(float dT, InputHandler * inputHandler) { int result = 0; return result; } int ButtonEntity::React(int entityID, EVENT reactEvent) { int result = 0; return result; } int ButtonEntity::...
```c++ #include "ButtonEntity.h" ButtonEntity::ButtonEntity() { } ButtonEntity::~ButtonEntity() { } int ButtonEntity::Update(float dT, InputHandler * inputHandler) { int result = 0; return result; } int ButtonEntity::React(int entityID, EVENT reactEvent) { int result = 0; return result; } int ButtonEntity::...
fb2f7321-3f91-4301-95fe-5ed625da7c77
{ "language": "C++" }
```c++ #include "protect.hpp" #include "../Exception.hpp" #include "../Jump_Tag.hpp" #ifndef TAG_RAISE #define TAG_RAISE 0x6 #endif VALUE Rice::detail:: protect( RUBY_VALUE_FUNC f, VALUE arg) { int state = 0; VALUE retval = rb_protect(f, arg, &state); if(state != 0) { if(state == TAG_RAISE && ruby...
```c++ #include "protect.hpp" #include "../Exception.hpp" #include "../Jump_Tag.hpp" #ifndef TAG_RAISE #define TAG_RAISE 0x6 #endif VALUE Rice::detail:: protect( RUBY_VALUE_FUNC f, VALUE arg) { int state = 0; VALUE retval = rb_protect(f, arg, &state); if(state != 0) { if(state == TAG_RAISE && RTES...
f85160dc-769b-4db5-957c-59f30f0a8fde
{ "language": "C++" }
```c++ #include "vsteventkeeper.h" #include <cstdint> namespace Airwave { VstEventKeeper::VstEventKeeper() : events_(nullptr), data_(nullptr) { } VstEventKeeper::~VstEventKeeper() { delete [] events_; } void VstEventKeeper::reload(int count, const VstEvent events[]) { if(!events_ || events_->numEvents < co...
```c++ #include "vsteventkeeper.h" #include <algorithm> #include <cstdint> namespace Airwave { VstEventKeeper::VstEventKeeper() : events_(nullptr), data_(nullptr) { } VstEventKeeper::~VstEventKeeper() { delete [] events_; } void VstEventKeeper::reload(int count, const VstEvent events[]) { if(!events_ || ev...
7259439c-ea44-470a-a0e5-055659248c0b
{ "language": "C++" }
```c++ #include "configuration.h" #include "AboutDialog.h" #include "ui_AboutDialog.h" #define define2string_p(x) #x #define define2string(x) define2string_p(x) AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDialog) { ui->setupUi(this); connect(ui->okButton, SIGNAL(clicke...
```c++ #include "configuration.h" #include "AboutDialog.h" #include "ui_AboutDialog.h" #define define2string_p(x) #x #define define2string(x) define2string_p(x) AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDialog) { ui->setupUi(this); connect(ui->okButton, SIGNAL(clicke...
3ab51ad8-de24-420c-919b-e8925313eda9
{ "language": "C++" }
```c++ // Copyright (c) 2020-2022 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #if defined(HAVE_CONFIG_H) #include <config/bitcoin-config.h> #endif #include <tinyformat.h> #include <util/syserror....
```c++ // Copyright (c) 2020-2022 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #if defined(HAVE_CONFIG_H) #include <config/bitcoin-config.h> #endif #include <tinyformat.h> #include <util/syserror....
f69194c5-e4b8-4790-bbfa-43b7aecda61c
{ "language": "C++" }
```c++ //===- MCSchedule.cpp - Scheduling ------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
```c++ //===- MCSchedule.cpp - Scheduling ------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
94561ce1-f320-4dd6-974b-c55319de0b6f
{ "language": "C++" }
```c++ #include "builtin/class.hpp" #include "builtin/atomic.hpp" #include "ontology.hpp" namespace rubinius { void AtomicReference::init(STATE) { GO(atomic_ref).set(ontology::new_class(state, "AtomicReference", G(object), G(rubinius))); G(atomic_ref)->set_object_type(state, AtomicReferenceType);...
```c++ #include "builtin/class.hpp" #include "builtin/atomic.hpp" #include "ontology.hpp" namespace rubinius { void AtomicReference::init(STATE) { GO(atomic_ref).set(ontology::new_class(state, "AtomicReference", G(object), G(rubinius))); G(atomic_ref)->set_object_type(state, AtomicReferenceType);...
97f53c5d-1ec3-4bbe-88e5-4ac839b6aa67
{ "language": "C++" }
```c++ #include <stdio.h> #define MAX_LOOP 10000 double formula(const double x, const double k) { return (x * x) / ((2 * k - 1) * (2 * k)); } int main(void) { double x; printf("Enter x= "); scanf("%lf", &x); double cosx = 1, sinx = x; int k = 2; while(k < MAX_LOOP) { ...
```c++ #include <stdio.h> #define MAX_LOOP 100 double cosine_formula(const double x, const double k) { if(k == 0) return 1; return (x * x) / ((2 * k - 1) * (2 * k)); } double sine_formula(const double x, const double k) { if(k == 0) return x; return (x * x) / ((2 * k) * (2 * k + 1)); } int main(v...
6a7b957b-144e-4f1c-83d8-ea7cbd54fe63
{ "language": "C++" }
```c++ #include "arithmetics.hpp" namespace arithmetics { int add(int a, int b) { return a + b; } int add_buggy(int a, int b) { return a + b + 1; } } ``` Fix bug to see efect for Travis
```c++ #include "arithmetics.hpp" namespace arithmetics { int add(int a, int b) { return a + b; } int add_buggy(int a, int b) { return a + b; } } ```
595482d9-7fb7-4e80-80f8-5987e2e529fc
{ "language": "C++" }
```c++ #include "other.hpp" using namespace LD22; Other::~Other() { } void Other::advance() { Walker::advance(); } ``` Make Other chase after items
```c++ #include "other.hpp" #include "item.hpp" using namespace LD22; Other::~Other() { } void Other::advance() { scanItems(); if (m_item) { int wx = centerx(), wy = centery(); int ix = m_item->centerx(), iy = m_item->centery(); int dx = ix - wx, dy = iy - wy; if (dx < -20) ...
b138ae62-579e-43a3-b481-9f8a6cedf3f0
{ "language": "C++" }
```c++ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "lid_reuse_delayer_config.h" #include <vespa/searchcore/proton/server/documentdbconfig.h> namespace proton::documentmetastore { LidReuseDelayerConfig::LidReuseDelayerConfig(const Doc...
```c++ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "lid_reuse_delayer_config.h" #include <vespa/searchcore/proton/server/documentdbconfig.h> namespace proton::documentmetastore { LidReuseDelayerConfig::LidReuseDelayerConfig(const Doc...
6a81788a-d1ac-40e2-a406-2ce3b4aea08e
{ "language": "C++" }
```c++ // ------------------------------------------------------------------ // ofxTPSprite.cpp // ofxTexturePacker - https://www.github.com/danoli3/ofxTexturePacker // Created by Daniel Rosser and Colin Friend on 9/06/2014. // ------------------------------------------------------------------ #include "ofxTPSprite.h" ...
```c++ // ------------------------------------------------------------------ // ofxTPSprite.cpp // ofxTexturePacker - https://www.github.com/danoli3/ofxTexturePacker // Created by Daniel Rosser and Colin Friend on 9/06/2014. // ------------------------------------------------------------------ #include "ofxTPSprite.h" ...
22c2dd8b-086c-46b9-a526-4bfe894354ae
{ "language": "C++" }
```c++ /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable l...
```c++ /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable l...
bd807605-8236-473e-bb5c-2ea1feb4b167
{ "language": "C++" }
```c++ /* * Copyright 2016 - 2019 gtalent2@gmail.com * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include <QApplication> #include <QDebug> #include <ox/c...
```c++ /* * Copyright 2016 - 2019 gtalent2@gmail.com * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include <QApplication> #include <QDebug> #include <ox/c...
9d25ad90-e02e-49e2-9c00-70299eab3d75
{ "language": "C++" }
```c++ /****************************************************************************** * Turbo C++11 metaprogramming Library * * * * Copyright (C) 2013 - 2014, Manuel Sánchez Pérez ...
```c++ /****************************************************************************** * Turbo C++11 metaprogramming Library * * * * Copyright (C) 2013 - 2014, Manuel Sánchez Pérez ...
1d12ed8a-846f-4756-a2d8-48c3c179ae21
{ "language": "C++" }
```c++ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===---------------------------------...
```c++ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===---------------------------------...
d322016b-a168-44b1-a6dc-01af4dd67d3d
{ "language": "C++" }
```c++ #include "BenchmarkStack.h" #include "StackAllocator.h" BenchmarkStack::BenchmarkStack(const int runtime) : Benchmark(runtime) { } BenchmarkResults BenchmarkStack::allocation() { setStartTimer(); StackAllocator stackAllocator(1e10); int operations = 0; while(!outOfTime()){ stackAllocator.Allocate(siz...
```c++ #include "BenchmarkStack.h" #include "StackAllocator.h" BenchmarkStack::BenchmarkStack(const int runtime) : Benchmark(runtime) { } BenchmarkResults BenchmarkStack::allocation() { setStartTimer(); StackAllocator stackAllocator(1e10); int operations = 0; while(!outOfTime()){ stackAllocator.Allocate(siz...
ebd2ef09-8437-4b3b-80c3-7ebde317cf4f
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify -fms-extensions %s typedef long HRESULT; typedef unsigned long ULONG; typedef struct _GUID { unsigned long Data1; unsigned short Data2; unsigned short Data3; unsigned char Data4[8]; } GUID; typedef GUID IID; // remove stdcall, since...
```c++ // RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s // expected-no-diagnostics typedef long HRESULT; typedef unsigned long ULONG; typedef struct _GUID { unsigned long Data1; unsigned short Data2; unsigned short Data3; unsigned char Data4[8]; } GUID; typedef GUID IID; // remove stdcall, since the...
eeb69557-5442-4387-9577-68647804755b
{ "language": "C++" }
```c++ #include <pangolin/video/video_help.h> #include <pangolin/video/video_interface.h> namespace pangolin { void PrintPixelFormats(std::ostream& out, bool color) { const std::string c_normal = color ? "\033[0m" : ""; const std::string c_alias = color ? "\033[32m" : ""; out << "Supported pixel format ...
```c++ #include <pangolin/video/video_help.h> #include <pangolin/video/video_interface.h> #include <pangolin/factory/RegisterFactoriesVideoInterface.h> #include <pangolin/factory/RegisterFactoriesVideoOutputInterface.h> namespace pangolin { void PrintPixelFormats(std::ostream& out, bool color) { const std::strin...
1652b8fb-b989-4923-a8fc-dcc2bff3aef6
{ "language": "C++" }
```c++ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===---------------------------------...
```c++ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===---------------------------------...
4de30762-1618-48bb-9871-0d1b45553c3b
{ "language": "C++" }
```c++ struct C { int A, B; ~C() {} void operator^(C b) const { } }; void test(C *P) { *P ^ *P; } ``` Simplify test, include problem analysis
```c++ // Non-POD classes cannot be passed into a function by component, because their // dtors must be run. Instead, pass them in by reference. The C++ front-end // was mistakenly "thinking" that 'foo' took a structure by component. struct C { int A, B; ~C() {} }; void foo(C b); void test(C *P) { ...
88600f0b-1330-4931-8952-e3c277f5d26c
{ "language": "C++" }
```c++ #include <memory> #include "Vec2i.h" #include "IMapElement.h" #include "CActor.h" namespace WizardOfGalicia { CActor::CActor() { emission = 0; stance = Stance::STANDING; attack = 0; defence = 0; hp = 0; direction = Direction::N; } bool CActor::canMove() { return true; ...
```c++ #include <memory> #include "Vec2i.h" #include "IMapElement.h" #include "CActor.h" namespace WizardOfGalicia { CActor::CActor() { emission = 0; stance = Stance::STANDING; attack = 0; defence = 0; hp = 0; direction = Direction::N; } bool CActor::canMove() { return true; ...
84525184-632d-4e72-b4b6-02a704bd8a6f
{ "language": "C++" }
```c++ #include <gtest/gtest.h> #include "keystore.h" #include "zcash/Address.hpp" TEST(keystore_tests, store_and_retrieve_spending_key) { CBasicKeyStore keyStore; std::set<libzcash::PaymentAddress> addrs; keyStore.GetPaymentAddresses(addrs); ASSERT_EQ(0, addrs.size()); auto sk = libzcash::Spend...
```c++ #include <gtest/gtest.h> #include "keystore.h" #include "zcash/Address.hpp" TEST(keystore_tests, store_and_retrieve_spending_key) { CBasicKeyStore keyStore; libzcash::SpendingKey skOut; std::set<libzcash::PaymentAddress> addrs; keyStore.GetPaymentAddresses(addrs); ASSERT_EQ(0, addrs.size()...
b8f6ca3a-1fd6-495b-886c-bdb22f25bfd8
{ "language": "C++" }
```c++ /* Copyright 2014-2015 Juhani Numminen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law o...
```c++ /* Copyright 2014-2015 Juhani Numminen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law o...
d37580df-33ce-4334-b7e1-bb76b4c9e5bf
{ "language": "C++" }
```c++ #include "DownloadManager.h" #include <cstdio> #include <iostream> #include <string> using namespace tinydm; int main(int argc, char **argv) { if (argc < 2) { std::cerr << "Usage: tinydm [threads]" << std::endl; return EXIT_FAILURE; } int threads = std::atoi(argv[1]); if (threads == 0) { ...
```c++ #include "DownloadManager.h" #include <cstdio> #include <iostream> #include <string> using namespace tinydm; int main(int argc, char **argv) { if (argc < 2) { std::cerr << "Usage: tinydm [threads]" << std::endl; return EXIT_FAILURE; } int threads = std::atoi(argv[1]); if (threads <= 0) { ...
505a2388-5af1-47dc-a73a-e204a5a7ad41
{ "language": "C++" }
```c++ // Copyright 2008 Paul Hodge #include "common_headers.h" #include "circa.h" #include "tests/common.h" namespace circa { namespace primitive_type_tests { void strings() { Branch* branch = new Branch(); Term* str1 = constant_string(branch, "one"); Term* str2 = constant_string(branch, "two"); t...
```c++ // Copyright 2008 Paul Hodge #include "common_headers.h" #include "circa.h" #include "tests/common.h" namespace circa { namespace primitive_type_tests { void strings() { Branch* branch = new Branch(); Term* str1 = constant_string(branch, "one"); Term* str2 = constant_string(branch, "two"); t...
635bf90f-bdb5-4085-9b41-643258324b96
{ "language": "C++" }
```c++ //===-- PluginLoader.cpp - Implement -load command line option ------------===// // // This file implements the -load <plugin> command line option processor. When // linked into a program, this new command line option is available that allows // users to load shared objects into the running program. // // Note ...
```c++ //===-- PluginLoader.cpp - Implement -load command line option ------------===// // // This file implements the -load <plugin> command line option processor. When // linked into a program, this new command line option is available that allows // users to load shared objects into the running program. // // Note ...
8eb6f461-dffe-410f-a0f1-0c8d56948961
{ "language": "C++" }
```c++ /** * This test checks whether we detect a deadlock arising from a parent thread * trying to join a child who requires a lock held by its parent in order to * finish. */ #include <d2mock.hpp> int main(int argc, char const* argv[]) { d2mock::mutex G; d2mock::thread t1([&] { G.lock(); ...
```c++ /** * This test checks whether we detect a deadlock arising from a parent thread * trying to join a child who requires a lock held by its parent in order to * finish. */ #include <d2mock.hpp> int main(int argc, char const* argv[]) { d2mock::mutex G; d2mock::thread t1([&] { G.lock(); ...
a2dfef16-c082-4936-8d89-b00d9ae0d0a9
{ "language": "C++" }
```c++ #include <omp.h> #include "proctor/detector.h" #include "proctor/proctor.h" #include "proctor/scanning_model_source.h" #include "proctor/basic_proposer.h" using pcl::proctor::Detector; //using pcl::proctor::ProctorMPI; using pcl::proctor::Proctor; using pcl::proctor::ScanningModelSource; using pcl::proctor::Ba...
```c++ #include "proctor/detector.h" #include "proctor/proctor.h" #include "proctor/scanning_model_source.h" #include "proctor/basic_proposer.h" using pcl::proctor::Detector; //using pcl::proctor::ProctorMPI; using pcl::proctor::Proctor; using pcl::proctor::ScanningModelSource; using pcl::proctor::BasicProposer; int ...
f6008dbb-35aa-44b9-8a15-dcf003156c2a
{ "language": "C++" }
```c++ /* * RandMeasure.cpp * * Created on: 19.01.2013 * Author: Christian Staudt (christian.staudt@kit.edu) */ #include "NodeStructuralRandMeasure.h" namespace NetworKit { double NodeStructuralRandMeasure::getDissimilarity(const Graph& G, const Partition& first, const Partition& second) { count n = G....
```c++ /* * RandMeasure.cpp * * Created on: 19.01.2013 * Author: Christian Staudt (christian.staudt@kit.edu) */ #include "NodeStructuralRandMeasure.h" namespace NetworKit { double NodeStructuralRandMeasure::getDissimilarity(const Graph& G, const Partition& first, const Partition& second) { count n = G....
ddb82359-99ba-447c-b680-ebf752175b3f
{ "language": "C++" }
```c++ // For conditions of distribution and use, see copyright notice in license.txt #include "UpdateModuleMac.h" #include "Framework.h" #include "CoreDefines.h" #include "Application.h" UpdateModule::UpdateModule() : IModule("UpdateModule"), updater_(0) { } UpdateModule::~UpdateModule() { } void UpdateMo...
```c++ // For conditions of distribution and use, see copyright notice in license.txt #include "UpdateModuleMac.h" #include "Framework.h" #include "CoreDefines.h" #include "Application.h" UpdateModule::UpdateModule() : IModule("UpdateModule"), updater_(0) { } UpdateModule::~UpdateModule() { } void UpdateMo...
e4517e96-744e-4998-ba9c-ef6e674e8551
{ "language": "C++" }
```c++ #include <QApplication> #include <QSettings> #include <QLocale> #include <QTranslator> #include <QLibraryInfo> #include "trayicon.h" int main(int argc, char **argv) { QApplication app(argc, argv); QApplication::setOrganizationName("Restnotifier"); app.setQuitOnLastWindowClosed(false); // Set...
```c++ #include <QApplication> #include <QSettings> #include <QLocale> #include <QTranslator> #include <QLibraryInfo> #include "trayicon.h" int main(int argc, char **argv) { QApplication app(argc, argv); QApplication::setOrganizationName("Restnotifier"); app.setQuitOnLastWindowClosed(false); // Set...
b9912d3d-9ff1-4296-93b0-09b0c7b3b18c
{ "language": "C++" }
```c++ /* * rngs * ECE 541 Project 2 * Kashev Dalmia - dalmia3 * David Huang - huang157 */ #include "ranlux32.h" namespace rng { RANLUX32::RANLUX32() : RandomNumberGenerator(), prev(0), count(0), state(), index(0) {} void RANLUX32::seed(fuint seed_num) { ...
```c++ /* * rngs * ECE 541 Project 2 * Kashev Dalmia - dalmia3 * David Huang - huang157 */ #include "ranlux32.h" namespace rng { RANLUX32::RANLUX32() : RandomNumberGenerator(), prev(0), count(0), state(), index(0) {} void RANLUX32::seed(fuint seed_num) { ...
89344251-f559-46fa-ae88-2be73430a7b8
{ "language": "C++" }
```c++ VectorXf v; v.setLinSpaced(5,0.5f,1.5f).transpose(); cout << v << endl; ``` Remove confusing transpose() in setLinSpaced() docs.
```c++ VectorXf v; v.setLinSpaced(5,0.5f,1.5f); cout << v << endl; ```
14d217e9-ea61-495b-ade8-67b0c28edae7
{ "language": "C++" }
```c++ #include "edge.h" void Dictionary::Add(MonoObject* _this, const char* name, MonoObject* value) { static MonoMethod* add; if(!add) { add = mono_class_get_method_from_name(mono_object_get_class(_this), "System.Collections.Generic.IDictionary<string,object>.Add", -1); } v...
```c++ #include "edge.h" void Dictionary::Add(MonoObject* _this, const char* name, MonoObject* value) { static MonoMethod* add; if(!add) { add = mono_class_get_method_from_name(mono_object_get_class(_this), "System.Collections.Generic.IDictionary<string,object>.Add", -1); // This...
769cc6cc-cf6c-4034-a249-a553364b1df3
{ "language": "C++" }
```c++ #include "stdafx.h" #include "CppUnitTest.h" #include "datastore.h" #include "transaction.h" #include "internal/operations/post_operation.h" #include "dummy_values.h" using Assert = Microsoft::VisualStudio::CppUnitTestFramework::Assert; namespace You { namespace DataStore { namespace UnitTests { TEST_CLASS(Da...
```c++ #include "stdafx.h" #include "CppUnitTest.h" #include "datastore.h" #include "transaction.h" #include "internal/operations/post_operation.h" #include "internal/operations/put_operation.h" #include "internal/operations/erase_operation.h" #include "dummy_values.h" using Assert = Microsoft::VisualStudio::CppUnitT...
c4463b1d-8989-4ceb-8a44-c0005a3f555f
{ "language": "C++" }
```c++ #include <zombye/gameplay/states/menu_state.hpp> #include <zombye/rendering/camera_component.hpp> using namespace std::string_literals; zombye::menu_state::menu_state(zombye::state_machine *sm) : sm_(sm) { } void zombye::menu_state::enter() { zombye::log("enter menu state"); } void zombye::menu_state::l...
```c++ #include <zombye/gameplay/states/menu_state.hpp> #include <zombye/rendering/camera_component.hpp> using namespace std::string_literals; zombye::menu_state::menu_state(zombye::state_machine *sm) : sm_(sm) { } void zombye::menu_state::enter() { zombye::log("enter menu state"); auto& camera = sm_->get_g...
ca720a18-01fd-4721-be32-589610c010b4
{ "language": "C++" }
```c++ /* Copyright 2016 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable l...
```c++ /* Copyright 2016 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable l...
fb735e9d-9f20-4adb-a0d1-a04a70e8f7c7
{ "language": "C++" }
```c++ // Copyright (c) 2015 The Bitcoin Core developers // Copyright (c) 2015-2018 The Bitcoin Unlimited developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "bench.h" #include "main.h" #include "utiltime.h" // ...
```c++ // Copyright (c) 2015 The Bitcoin Core developers // Copyright (c) 2015-2018 The Bitcoin Unlimited developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "bench.h" #include "utiltime.h" // Sanity test: this ...
05012de0-a11d-4b77-8d87-4a7007c319ac
{ "language": "C++" }
```c++ //===- ChainedDiagnosticConsumer.cpp - Chain Diagnostic Clients -*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
```c++ //===- ChainedDiagnosticConsumer.cpp - Chain Diagnostic Clients -----------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
ca24515d-3519-423e-82e2-da2ada062017
{ "language": "C++" }
```c++ /** * @file main.cpp * @author Volodymyr Shymanskyy * @license This project is released under the MIT License (MIT) * @copyright Copyright (c) 2015 Volodymyr Shymanskyy * @date Mar 2015 * @brief */ //#define BLYNK_DEBUG #define BLYNK_PRINT stdout #ifdef RASPBERRY #include <BlynkApiW...
```c++ /** * @file main.cpp * @author Volodymyr Shymanskyy * @license This project is released under the MIT License (MIT) * @copyright Copyright (c) 2015 Volodymyr Shymanskyy * @date Mar 2015 * @brief */ //#define BLYNK_DEBUG #define BLYNK_PRINT stdout #ifdef RASPBERRY #include <BlynkApiW...
a16f6e72-ac45-4143-9461-821c8ecd4bbf
{ "language": "C++" }
```c++ // Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/test/test_suite.h" #include "media/base/media.h" int main(int argc, char** argv) { base::TestSuite suite(argc, argv); medi...
```c++ // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/at_exit.h" #include "base/command_line.h" #include "base/logging.h" #include "base/test/test_suite.h" #include "media/base/media...
2be3f0ed-40b2-44f6-8589-4f56f8e9ae51
{ "language": "C++" }
```c++ #include "ConnectCallVisitor.h" bool ConnectCallVisitor::VisitCallExpr(clang::CallExpr *expr) { return true; } ``` Add heuristics for finding QObject::connect
```c++ #include <iostream> #include "ConnectCallVisitor.h" namespace { bool isQObjectConnect(clang::CallExpr *expr) { // These are needed a lot so keep them around static const clang::StringRef expectedMethodName("connect"); static const clang::StringRef expectedClassName("QObject"); const clang::Decl *cal...
ccbc4b27-59d0-4535-bcda-d537c54b32e0
{ "language": "C++" }
```c++ #include "RNG.h" #include "Utils.h" #include <cmath> namespace DNest4 { RNG::RNG() :uniform(0., 1.) ,normal(0., 1.) { } void RNG::set_seed(unsigned int seed) { twister.seed(seed); } double RNG::rand() { return uniform(twister); } double RNG::randn() { return normal(twister); } double RNG::randh() { re...
```c++ #include "RNG.h" #include "Utils.h" #include <cmath> namespace DNest4 { RNG::RNG() :uniform(0., 1.) ,normal(0., 1.) { } void RNG::set_seed(unsigned int seed) { twister.seed(seed); } double RNG::rand() { return uniform(twister); } double RNG::randn() { return normal(twister); } double RNG::randh() { ...
209e9a13-da51-4906-a700-6052e710b1cb
{ "language": "C++" }
```c++ #include "gameboy.h" #include "cartridge.h" #include "video/screen.h" #include "util/log.h" #include "video/screens/null_screen.h" #include "video/screens/sfml_screen.h" int main(int argc, char* argv[]) { log_set_level(LogLevel::Trace); if (argc < 2) { log_error("Please provide a ROM file to r...
```c++ #include "gameboy.h" #include "cartridge.h" #include "video/screen.h" #include "util/log.h" #include "video/screens/null_screen.h" #include "video/screens/sfml_screen.h" int main(int argc, char* argv[]) { log_set_level(LogLevel::Debug); if (argc < 2) { log_error("Please provide a ROM file to r...
c8a1f521-e5dc-4323-bbc7-3ca2e1da4df9
{ "language": "C++" }
```c++ //===--------------------- cxa_thread_atexit_test.cpp ---------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===---------------------------------...
```c++ //===--------------------- cxa_thread_atexit_test.cpp ---------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===---------------------------------...
c97688d7-af0d-4648-b152-97ae2840630d
{ "language": "C++" }
```c++ #include "ihex.h" #include <stdlib.h> int main(int argc, char* argv[]) { if (argc != 4) { std::cerr << argv[0] << " input.hex keyfile output.hex\n" << "Encrypts or decrypts the data in an Intel Hex file.\n" << "Addresses are unchanged, but checksum is updated.\n"; exit(-1); } IntelHex file; fi...
```c++ #include "ihex.h" #include <stdlib.h> int main(int argc, char* argv[]) { if (argc != 4) { std::cerr << argv[0] << " input.hex keyfile output.hex\n" "Encrypts or decrypts the data in an Intel Hex file.\n" "Addresses are unchanged, but checksum is updated.\n\n" "The [keyfile] is a raw binary file wi...
0c3d1f75-ab2c-448f-9d87-d6f81f8e80a2
{ "language": "C++" }
```c++ #include "VolumeSlider.h" #include "Skin.h" VolumeSlider::VolumeSlider(HINSTANCE hInstance, Settings &settings) : OSD(hInstance, L"3RVX-VolumeSlider", settings), _mWnd(hInstance, L"3RVX-VolumeSliderWnd", L"3RVX Volume Slider") { std::wstring skinXML = settings.SkinXML(); Skin skin(skinXML); long ...
```c++ #include "VolumeSlider.h" #include "Skin.h" VolumeSlider::VolumeSlider(HINSTANCE hInstance, Settings &settings) : OSD(hInstance, L"3RVX-VolumeSlider", settings), _sWnd(hInstance, L"3RVX-VolumeSliderWnd", L"3RVX Volume Slider") { std::wstring skinXML = settings.SkinXML(); Skin skin(skinXML); Gdipl...
9e637511-36e9-4989-877a-629a096dd10a
{ "language": "C++" }
```c++ #include "mainwindow.h" #include "bucketlist.h" #include <QLabel> #include <QBoxLayout> #include <QtWebKit> #include <QSettings> #include <QInputDialog> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { QWidget *central = new QWidget; setCentralWidget(central); QBoxLayout *topLa...
```c++ #include "mainwindow.h" #include "bucketlist.h" #include <QLabel> #include <QBoxLayout> #include <QtWebKit> #include <QSettings> #include <QInputDialog> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { QWidget *central = new QWidget; setCentralWidget(central); QBoxLayout *topLa...
8aa63b54-acad-4a7c-b902-18a59c252fa8
{ "language": "C++" }
```c++ // Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chromeos/system/devicetype.h" #include <string> #include "base/sys_info.h" namespace chromeos { namespace { const char kDeviceType[] ...
```c++ // Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chromeos/system/devicetype.h" #include <string> #include "base/sys_info.h" namespace chromeos { namespace { const char kDeviceType[] ...
af7ce0e7-55bd-4bcf-a129-f4e195a313e9
{ "language": "C++" }
```c++ #include <3ds.h> #include <stdio.h> void shutdown3DS() { Handle nssHandle = 0; Result result = srvGetServiceHandle(&nssHandle, "ns:s"); if (result != 0) return; // http://3dbrew.org/wiki/NSS:ShutdownAsync u32 *commandBuffer = getThreadCommandBuffer(); commandBuffer[0] = 0x000E0000; sv...
```c++ #include <3ds.h> #include <stdio.h> // http://3dbrew.org/wiki/NSS:ShutdownAsync void NSS_ShutdownAsync(void) { Handle nssHandle = 0; Result result = srvGetServiceHandle(&nssHandle, "ns:s"); if (result != 0) return; u32 *commandBuffer = getThreadCommandBuffer(); commandBuffer[0] = 0x000E0000;...
8579f270-87e8-4b0d-97a3-edf5582af1e7
{ "language": "C++" }
```c++ #include "Name.h" bool Name::init(String name) { size = name.length() + 1; data = (uint8_t *) malloc(size); if (data != NULL) { uint8_t lastDot = size; for (uint8_t i = size - 1; i > 0; i--) { uint8_t c = name.charAt(i - 1); if (c =...
```c++ #include "Name.h" bool Name::init(String name) { size = name.length() + 1; data = (uint8_t *) malloc(size); if (data != NULL) { uint8_t lastDot = size; for (uint8_t i = size - 1; i > 0; i--) { uint8_t c = name.charAt(i - 1); if (c =...
098badb2-cfb3-4d35-84c8-104a0d97cda0
{ "language": "C++" }
```c++ #include "./Sphere.hpp" #include "./misc.hpp" #include <algorithm> #include <cmath> namespace yks { Optional<float> intersect(const vec3& origin, float radius, const Ray& r) { const vec3 o = r.origin - origin; const vec3 v = r.direction; float t1, t2; const int solutions = solve_quadratic(dot(v, v), ...
```c++ #include "./Sphere.hpp" #include "./misc.hpp" #include <algorithm> #include <cmath> namespace yks { Optional<float> intersect(const vec3& origin, float radius, const Ray& r) { const vec3 o = r.origin - origin; const vec3 v = r.direction; float t1, t2; const int solutions = solve_quadratic(dot(v, v), ...
b7373ecc-1c9e-4d7d-bf5f-709e3ff15e7a
{ "language": "C++" }
```c++ // RUN: %clang -### -Wlarge-by-value-copy %s 2>&1 | FileCheck -check-prefix=LARGE_VALUE_COPY_DEFAULT %s // LARGE_VALUE_COPY_DEFAULT: -Wlarge-by-value-copy=64 // RUN: %clang -### -Wlarge-by-value-copy=128 %s 2>&1 | FileCheck -check-prefix=LARGE_VALUE_COPY_JOINED %s // LARGE_VALUE_COPY_JOINED: -Wlarge-by-value-cop...
```c++ // RUN: %clang -### -Wlarge-by-value-copy %s 2>&1 | FileCheck -check-prefix=LARGE_VALUE_COPY_DEFAULT %s // LARGE_VALUE_COPY_DEFAULT: -Wlarge-by-value-copy=64 // RUN: %clang -### -Wlarge-by-value-copy=128 %s 2>&1 | FileCheck -check-prefix=LARGE_VALUE_COPY_JOINED %s // LARGE_VALUE_COPY_JOINED: -Wlarge-by-value-cop...
940cf2f3-ab51-4532-a17d-d1608c675d2d
{ "language": "C++" }
```c++ #include "rdb_protocol/configured_limits.hpp" #include "rdb_protocol/wire_func.hpp" #include "rdb_protocol/func.hpp" namespace ql { configured_limits_t from_optargs(const std::map<std::string, wire_func_t> &arguments) { auto p = arguments.find("arrayLimit"); if (p != arguments.end()) { // Fake a...
```c++ #include "rdb_protocol/configured_limits.hpp" #include "rdb_protocol/wire_func.hpp" #include "rdb_protocol/func.hpp" namespace ql { configured_limits_t from_optargs(const std::map<std::string, wire_func_t> &arguments) { auto p = arguments.find("arrayLimit"); if (p != arguments.end()) { // Fake a...
c01992d9-a158-444e-9278-3918a129ed9e
{ "language": "C++" }
```c++ //===---------------------------- temporary.cpp ---------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===---------------------------------...
```c++ //===---------------------------- temporary.cpp ---------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===---------------------------------...
985032a6-75ee-4e2b-bb40-cd74bb042af5
{ "language": "C++" }
```c++ /* * main.cpp * * Copyright (C) 2018 [ A Legge Up ] * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ #include <stdio.h> #include "HardwareConfig.h" #include "AnimationTask.h" extern "C" void app_main() { HardwareConfig har...
```c++ /* * main.cpp * * Copyright (C) 2018 [ A Legge Up ] * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ #include <stdio.h> #include "HardwareConfig.h" #include "AnimationTask.h" extern "C" void app_main() { HardwareConfig har...
845d384e-5e8f-46b7-9ce9-4f32444978ef
{ "language": "C++" }
```c++ #include "rssitem.h" #include "3rd-party/catch.hpp" #include "cache.h" #include "configcontainer.h" using namespace newsboat; TEST_CASE("RssItem::sort_flags() cleans up flags", "[rss]") { ConfigContainer cfg; Cache rsscache(":memory:", &cfg); RssItem item(&rsscache); SECTION("Repeated letters do not eras...
```c++ #include "rssitem.h" #include "3rd-party/catch.hpp" #include "cache.h" #include "configcontainer.h" using namespace newsboat; TEST_CASE("RssItem::sort_flags() cleans up flags", "[RssItem]") { ConfigContainer cfg; Cache rsscache(":memory:", &cfg); RssItem item(&rsscache); SECTION("Repeated letters do not ...
7858185f-479d-4262-a094-05b1c7810524
{ "language": "C++" }
```c++ #include "Renderer.hpp" #include "Window.hpp" #include <cstring> #include <iostream> #include "Particle.png.hpp" int main(int argc, char* argv[]) { Window window; bool measure = false; if (argc > 1 && strcmp(argv[1], "measure") == 0) { std::cout << "Measuring..." << std::endl; m...
```c++ #include "Renderer.hpp" #include "Window.hpp" #include <cstring> #include <iostream> #include "Particle.png.hpp" int main(int argc, char* argv[]) { Window window; bool measure = false; if (argc > 1 && strcmp(argv[1], "measure") == 0) { std::cout << "Measuring..." << std::endl; m...
6c061d84-9c24-4dfd-9fe3-bbe81e2cfe76
{ "language": "C++" }
```c++ // If user provides his own libc functions, ASan doesn't // intercept these functions. // RUN: %clangxx_asan -O0 %s -o %t && %run %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -O2 %s -o %t && %run %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -O3 %...
```c++ // If user provides his own libc functions, ASan doesn't // intercept these functions. // RUN: %clangxx_asan -O0 %s -o %t && %run %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -O2 %s -o %t && %run %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -O3 %...
d860f638-4fae-450f-b4cb-6989df0fc3e7
{ "language": "C++" }
```c++ #include "iomidi.h" #include "db.h" #include <QtTest> class TestIOMIdi : public QObject { Q_OBJECT private slots: void test_handle(); void test_clientId(); void test_portId(); private: IOMidi io; }; void TestIOMIdi::test_handle() { snd_seq_t* seq = io.handle(); QVERIFY(seq); ...
```c++ #include "iomidi.h" #include "db.h" #include <QtTest> class TestIOMIdi : public QObject { Q_OBJECT private slots: void initTestCase(); void test_handle(); void test_clientId(); void test_portId(); private: IOMidi* io; }; void TestIOMIdi::initTestCase() { io = nullptr; try { ...
35668733-d03c-4f57-9140-89676c5b7bb4
{ "language": "C++" }
```c++ #include <iostream> #include "ignition/transport.hh" #include "fcmt/ign_nodes/examples/proto/echo.pb.h" int main(int argc, char *argv[]) { auto i = 0; while (true) { ignition::transport::Node node; fcmt::ign_nodes::examples::proto::EchoRequest request; request.set_value(i++); fcmt::ign_nod...
```c++ #include <iostream> #include "ignition/transport.hh" #include "fcmt/ign_nodes/examples/proto/echo.pb.h" int main(int argc, char *argv[]) { auto i = 0; ignition::transport::Node node; while (true) { fcmt::ign_nodes::examples::proto::EchoRequest request; request.set_value(i++); fcmt::ign_nodes...
7f98df08-2006-4ebe-b3ba-a9071b8a3c28
{ "language": "C++" }
```c++ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===---------------------------------...
```c++ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===---------------------------------...
a795f7d5-95a2-42cf-8164-125a60bdb50c
{ "language": "C++" }
```c++ /* RTcmix - Copyright (C) 2000 The RTcmix Development Team See ``AUTHORS'' for a list of contributors. See ``LICENSE'' for the license to this software and for a DISCLAIMER OF ALL WARRANTIES. */ #include <RTcmix.h> #include <Instrument.h> #include <ugens.h> int Instrument::rtsetoutput(float start, float...
```c++ /* RTcmix - Copyright (C) 2000 The RTcmix Development Team See ``AUTHORS'' for a list of contributors. See ``LICENSE'' for the license to this software and for a DISCLAIMER OF ALL WARRANTIES. */ #include <RTcmix.h> #include <Instrument.h> #include <ugens.h> int Instrument::rtsetoutput(float start, float...
8ccca134-ffac-4e1d-87d4-04f3d0814ba8
{ "language": "C++" }
```c++ #include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); } ``` Set local to C. Maybe not the best longterm solution.
```c++ #include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); std::locale::global( std::locale( "C" ) ); MainWindow w; w.show(); return a.exec(); } ```
28fcd46d-93f0-4812-91ad-99b1e270f78d
{ "language": "C++" }
```c++ // RUN: %clang_cc1 %s -g -S -emit-llvm -o - | FileCheck %s // FIXME: Failing on i686. // XFAIL: * // RUN: %clang_cc1 -triple i686-linux %s -g -S -emit-llvm -o - | FileCheck %s struct A { virtual void f(); }; struct B { virtual void f(); }; struct C : A, B { virtual void f(); }; void C::f() { } // CHE...
```c++ // RUN: %clang_cc1 %s -g -S -emit-llvm -o - | FileCheck %s struct A { virtual void f(); }; struct B { virtual void f(); }; struct C : A, B { virtual void f(); }; void C::f() { } // CHECK: [ DW_TAG_subprogram ] [line 15] [def] [_ZThn{{4|8}}_N1C1fEv] ```
814f28f6-9734-4bda-bdb7-70d5aa0393c3
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -debug-info-kind=line-tables-only %s -o - | FileCheck %s // Crasher for PR22929. class Base { virtual void VariadicFunction(...); }; class Derived : public virtual Base { virtual void VariadicFunction(...); }; void Derived::VariadicFunction(...) { }...
```c++ // RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -debug-info-kind=line-tables-only %s -o - | FileCheck %s // Crasher for PR22929. class Base { virtual void VariadicFunction(...); }; class Derived : public virtual Base { virtual void VariadicFunction(...); }; void Derived::VariadicFunction(...) { }...
acde1154-08d2-4d4e-a764-219107736be5
{ "language": "C++" }
```c++ #include "dota2api/gamemode.cpp" #include "gtest/gtest.h" TEST(GameMode, gameModeFromInt) { EXPECT_EQ ( dota2::GameMode::Unknown, dota2::gameModeFromInt(-1) ); for(const auto &mode : dota2::gameModes) { EXPECT_EQ ( mode.second, ...
```c++ #include "dota2api/gamemode.hpp" #include "gtest/gtest.h" TEST(GameMode, gameModeFromInt) { EXPECT_EQ ( dota2::GameMode::Unknown, dota2::gameModeFromInt(-1) ); for(const auto &mode : dota2::gameModes) { EXPECT_EQ ( mode.second, ...
d02ba8eb-ef41-4987-ae5c-22802c7e36c2
{ "language": "C++" }
```c++ #include "kobjects.h" #include "constants.h" #define PAGE_SIZE 0x1000 KCodeSet* FindTitleCodeSet(u64 title_id) { for (unsigned kproc_index = 0; kproc_index < kproc_num; kproc_index++) { KCodeSet* curr_codeset = (KCodeSet*)(kproc_start + kproc_size * kproc_index + kproc_codeset_offset); if (...
```c++ #include "kobjects.h" #include "constants.h" #define PAGE_SIZE 0x1000 KCodeSet* FindTitleCodeSet(u64 title_id) { for (unsigned kproc_index = 0; kproc_index < kproc_num; kproc_index++) { KCodeSet* curr_codeset = *(KCodeSet**)(kproc_start + kproc_size * kproc_index + kproc_codeset_offset); if...
96730038-baa3-4e6f-a461-0a9e35f1ed5c
{ "language": "C++" }
```c++ // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "content/public/test/layouttest_support.h" #include "base/callback.h" #include "base/lazy_instance.h" #include "content/renderer/rend...
```c++ // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "content/public/test/layouttest_support.h" #include "base/callback.h" #include "base/lazy_instance.h" #include "content/renderer/rend...
d9024b8a-d9eb-4585-ae49-f85ce4179dac
{ "language": "C++" }
```c++ // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "net/disk_cache/cache_util.h" #include "base/file_util.h" #include "base/logging.h" #include "base/string_util.h" namespace dis...
```c++ // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "net/disk_cache/cache_util.h" #include "base/file_util.h" #include "base/logging.h" #include "base/string_util.h" namespace dis...
aadd59ee-e88f-46aa-8207-e517a4447833
{ "language": "C++" }
```c++ #include "exceptions.hpp" #include <nan.h> #include <gfcpp/GemfireCppCache.hpp> #include <sstream> void ThrowGemfireException(const gemfire::Exception & e) { std::stringstream errorMessageStream; errorMessageStream << e.getName() << ": " << e.getMessage(); e.printStackTrace(); NanThrowError(errorMessa...
```c++ #include "exceptions.hpp" #include <nan.h> #include <gfcpp/GemfireCppCache.hpp> #include <sstream> void ThrowGemfireException(const gemfire::Exception & e) { std::stringstream errorMessageStream; errorMessageStream << e.getName() << ": " << e.getMessage(); NanThrowError(errorMessageStream.str().c_str()); ...
d2bcc7ec-9974-4ffa-987d-483d77d90589
{ "language": "C++" }
```c++ /* * Copyright 2012 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "GrTypes.h" #include "SkThread.h" // for sk_atomic_inc // This used to be a global scope, but we got a warning about unused variable // so we moved it i...
```c++ /* * Copyright 2012 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "GrTypes.h" #include "SkThread.h" // for sk_atomic_inc // Well, the dummy_ "fix" caused a warning on windows, so hiding all of it // until we can find a...
f5dafbb4-8956-4501-ad90-4e27b58fab31
{ "language": "C++" }
```c++ #include "aquila/source/generator/SineGenerator.h" #include "aquila/wrappers/SoundBufferAdapter.h" #include "UnitTest++/UnitTest++.h" SUITE(SoundBufferAdapter) { TEST(NumSamples) { Aquila::SineGenerator generator(128); generator.setAmplitude(1).setFrequency(8).generate(64); Aqui...
```c++ #include "aquila/source/generator/SineGenerator.h" #include "aquila/wrappers/SoundBufferAdapter.h" #include "UnitTest++/UnitTest++.h" SUITE(SoundBufferAdapter) { TEST(NumSamples) { Aquila::SineGenerator generator(128); generator.setAmplitude(1).setFrequency(8).generate(64); Aqui...