Skip to content

Instantly share code, notes, and snippets.

Nobuyuki Iwanaga ufcpp

Block or report user

Report or block ufcpp

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ufcpp
ufcpp / SurrogatePairEscape.java
Created Mar 22, 2020
Java のサロゲートペアのエスケープ
View SurrogatePairEscape.java
import java.util.*;
public class Main {
public static void main(String[] args) {
int a\u200Db = 1; // 識別子中の ZWJ は無視される。
System.out.println(ab); // なので ab と a\u200Db は同じ識別子。
System.out.println(\u0061\u0062); // a (U+0061) とか b (U+0062) とかのエスケープも可能。ab と \u0061\u0062 も同じ識別子。
int 𩸽 = 1;
System.out.println(\uD867\uDE3D); // 追加面文字はサロゲートペア2つのでエスケープ可能。𩸽 と \uD867\uDE3D も同じ識別子。
@ufcpp
ufcpp / UnicodeEscape.java
Created Mar 22, 2020
Java ってあらゆる処理より先に Unicode unescape 処理やるんだ…
View UnicodeEscape.java
import java.util.*;
public class Main {
public static void main\u0028String[] args) \u007B
\u0069nt 𩸽 \u003D 1;
System.out.println(\uD867\uDE3D);
}
}
@ufcpp
ufcpp / nullability16_5.cs
Created Feb 10, 2020
16.5 で修正される null 許容参照型がらみの問題
View nullability16_5.cs
// Visual Studio 16.5 で修正される null 許容参照型がらみの問題
#nullable enable
using System.Diagnostics.CodeAnalysis;
class X<T>
where T : class
{
[return:MaybeNull]
public T M() => null; // ここの null に警告出てた
@ufcpp
ufcpp / QuoteInDocComment.cs
Created Feb 9, 2020
XML doc コメント中での引用符
View QuoteInDocComment.cs
class Program
{
/// <summary>
/// <see cref=‘Main’/> U+2018, U+2019 を受け付けるらしい。
/// <see cref=“Main”/> U+201C, U+201D を受け付けるらしい。
/// </summary>
static void Main()
{
}
}
@ufcpp
ufcpp / IllFormedUnicode.cs
Created Jan 30, 2020
ill-formed な文字
View IllFormedUnicode.cs
using System;
using System.Runtime.InteropServices;
using System.Text;
class Program
{
static void Main()
{
var s = "😀";
//codepoint: 1F600
@ufcpp
ufcpp / MethodOrder.cs
Last active Jan 29, 2020
order of DeclaredMethods with < 86 members
View MethodOrder.cs
using System;
using System.IO;
using System.Reflection.PortableExecutable;
using System.Reflection.Metadata;
using System.Linq;
using System.Reflection;
class X
{
public void M00() { } public void M01() { } public void M02() { } public void M03() { } public void M04() { } public void M05() { } public void M06() { } public void M07() { } public void M08() { } public void M09() { }
@ufcpp
ufcpp / AssemblyReferences.cs
Created Jan 9, 2020
DLL の依存関係を調べる。bin フォルダーに作られる .deps.json の中から同じ情報取れそうかも。
View AssemblyReferences.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection.Metadata;
using System.Reflection.PortableExecutable;
static class Program
{
static void Main()
{
@ufcpp
ufcpp / DeepReadOnly.cs
Created Jan 7, 2020
readonly メソッド、ちゃんとフィールドの構造体が書き換わらないようにコピー取るみたい
View DeepReadOnly.cs
using System;
struct A
{
public int Value;
public void Increment() => Value++;
}
struct B
{
@ufcpp
ufcpp / Untitled.ipynb
Created Nov 9, 2019
dotnet try jupyter
View Untitled.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ufcpp
ufcpp / InterfaceGen.cs
Created Oct 31, 2019
interface いくつまで実装できるのか問題
View InterfaceGen.cs
using System.IO;
static class Program
{
static void Main()
{
var c = new C();
using var f = new StreamWriter(File.OpenWrite("out.cs"));
for (int i = 0; i < 65536; i++)
You can’t perform that action at this time.