#extern修飾子の意味
外部で定義される変数であることを宣言するための修飾子
ただし
extern修飾子を付けて変数aを宣言する => 変数aは外部定義される
は成り立つが、その逆
/* gcc 4.7.2 */ | |
#include <stdlib.h> | |
void f(int** const a) | |
{ | |
a = malloc(5 * sizeof(int)); // compile error | |
a[0] = malloc(sizeof(int)); | |
*a[0] = 100; | |
} |
#include <stdio.h> | |
#include <stdlib.h> | |
typedef struct ReactiveInt* ReactiveInt; | |
struct ReactiveInt | |
{ | |
int n; | |
int (*operator)(int, int); | |
ReactiveInt left, right; |
object_files = \ | |
frp_sample.o \ | |
frp_sample_lib.o | |
.SUFFIXES : .c | |
frp_sample: $(object_files) | |
gcc -Wall -o frp_sample $(object_files) | |
#!/usr/bin/env ruby | |
# -*- mode: ruby -*- | |
require 'net/http' | |
require 'uri' | |
require 'nokogiri' | |
module AOJ | |
extend self | |
def get(id) |
#include <iostream> | |
#include <cstdio> | |
#include <vector> | |
#include <algorithm> | |
#include <cstring> | |
#include <utility> | |
using namespace std; | |
typedef vector<vector<char> > B; | |
typedef pair<int, int> P; |
class RecordInstance | |
attr_reader :klass, :members | |
def initialize(klass, hash) | |
unless klass.members.all?{|name, type| hash.has_key?(name) && hash[name].is_a?(type)} | |
raise "Instance initialization error!!" | |
end | |
@klass = klass | |
@members = klass.members.keys.inject({}){|acc, name| acc.merge(name => hash[name])} | |
end |
{-# LANGUAGE Arrows #-} | |
import qualified FRP.Yampa as Y | |
type Inp = (String, String) | |
type Out = String | |
main = do | |
rh <- Y.reactInit initIO act sf | |
loop rh |
import qualified Data.ByteString as B | |
import GHC.IO.Handle | |
import System.Process | |
import System.IO | |
type Packet = B.ByteString | |
pktsize = 188 | |
main = do |
require 'test/unit' | |
require './tiny_frp.rb' | |
module TinyFRP | |
module UnitTest | |
module Util | |
def lift(&proc) | |
TinyFRP::Lift.new(&proc) | |
end |
#extern修飾子の意味
外部で定義される変数であることを宣言するための修飾子
ただし
extern修飾子を付けて変数aを宣言する => 変数aは外部定義される
は成り立つが、その逆