Skip to content

Instantly share code, notes, and snippets.

View jyasskin's full-sized avatar
💭
Back on Monday

Jeffrey Yasskin jyasskin

💭
Back on Monday
View GitHub Profile
# 1 "bad.h" 1
template <class A> struct MisplacedDbg;
# 1 "bad_partial.h"
template<class T> struct MisplacedDbg<T*>;
# 1 "bad_full.h"
struct Full;
template<> struct MisplacedDbg<Full>;
# 1 "util.h"
struct Arg;
typedef MisplacedDbg<Arg> Typedef1;
static void
update_class_location(tree cls, location_t new_location)
{
tree instantiations, tmpl_info, tmpl_decl;
DECL_SOURCE_LOCATION (TYPE_NAME (cls)) = new_location;
if ((tmpl_info = CLASSTYPE_TEMPLATE_INFO (cls)))
{
tmpl_decl = TI_TEMPLATE (tmpl_info);
for (instantiations = DECL_TEMPLATE_INSTANTIATIONS (tmpl_decl);
instantiations;
$ clang++ -O1 -g test.cc -fno-omit-frame-pointer -o test && ~/src/chromium/src/third_party/valgrind/linux_x64/bin/valgrind ./test
==10069== Memcheck, a memory error detector
==10069== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==10069== Using Valgrind-3.9.0.SVN and LibVEX; rerun with -h for copyright info
==10069== Command: ./test
==10069==
==10069== Conditional jump or move depends on uninitialised value(s)
==10069== at 0x400597: main (test.cc:15)
==10069==
Yep.
@jyasskin
jyasskin / instanceof_demo.html
Last active January 4, 2016 05:29
Running on localhost, this displays "Tag Name: CXX-FUNCTION; Instance of CxxFunctionElement: false", but when copied to jsbin, it shows "Tag Name: CXX-FUNCTION; Instance of CxxFunctionElement: true". I believe 'true' is the expected result.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<script src="//cdnjs.cloudflare.com/ajax/libs/polymer/0.1.3/platform.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/polymer/0.1.3/polymer.js"></script>
<polymer-element name="cxx-function" constructor="CxxFunctionElement" noscript>
<template>
<pre><code><content></content></code></pre>
@jyasskin
jyasskin / cmd
Created May 28, 2014 22:22
Demonstrate that classes default to external linkage.
$ clang++ test.cc test2.cc -o test && ./test
foo() == 1
bar() == 1
@jyasskin
jyasskin / keybase.md
Created June 12, 2014 21:29
Keybase proof

Keybase proof

I hereby claim:

  • I am jyasskin on github.
  • I am jyasskin (https://keybase.io/jyasskin) on keybase.
  • I have a public key whose fingerprint is 7CB6 F383 8DF1 49C7 05D6 B65B E1E4 DB16 D08D 0181

To claim this, I am signing this object:

@jyasskin
jyasskin / notes.md
Created July 3, 2014 19:30
Notes on HTML inadequacies

I'm the editor for the C++ Library Fundamentals TS, and I keep running into missing features in various bits of the HTML ecosystem that make this more difficult than it should be. I'm starting this document to record these so I can file useful bugs in the future.

HTML

Web Components

@jyasskin
jyasskin / step-button.html
Created September 3, 2014 23:41
<step-button>, a button that can vend promises that resolve when it's clicked
<!-- Call wait() on this button to return a Promise that resolves when the button is clicked. -->
<polymer-element name='step-button'>
<template><button on-click="{{step}}" disabled?="{{!_resolve}}">Step</button></template>
<script>
(function() {
Polymer('step-button', {
wait: function() {
var self = this;
return new Promise(function(resolve, reject) {
if (self._resolve) {
@jyasskin
jyasskin / designer.html
Last active August 29, 2015 14:10
designer
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../paper-item/paper-item.html">
<link rel="import" href="../paper-checkbox/paper-checkbox.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
@jyasskin
jyasskin / designer.html
Created December 5, 2014 01:14
designer
<link rel="import" href="../paper-button/paper-button.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;