Z               Z^
   ,88079
 KWWSSKSQHWDVVHUW
AA
y Z^        =
y      _ `a            ]
yGKDWHQDQHMSLBRJL
,88079
    ^
,88079  Z Z[
ERRO DVVHUW PL[HG DVVHUWLRQ
y2     [DVVHUWLRQ    =A Z
  )$/6(                ] =
y      =_c           [ =
   ...
,88079  Z Z[
y        _c          
y   3+38QLW  DVVHUW7UXH
   Z        =7UXH      ^ Z
     a        [^
ycc ` = DVVHUWDFWLY...
,88079  Z Z[
function hoge($max)
{
  // 0     $max
  $ret = mt_rand(0, $max):
                     *

    // 0     $max
  ...
,88079  Z Z[
function hoge($max)
{
  // 0     $max
  $ret = mt_rand(0, $max);
                     *

    // 0     $max
  ...
29*7,3/ LQW PLQ LQW PD[@

y    ] PWBUDQG   Z=
   PLQ ! PD[[       ^
y  Z         [
hoge(-10);
Warning: assert(): Assertion...
,88079                   
y           HYDO
y                    []]

    t   Z      ^       
y       ^=        ZHYDO
,88079                        1)
PHP_FUNCTION(assert)
{
    zval **assertion;
    int val;
    char *myeval = NULL;
    ch...
]   =   ^      Q ! +

y       W []]   =
 B     `a    ^Z
        ^
y1) ^Z    =
   3+3    ][
    Z
y       !                `aZ       ^
    
y                 HYDO         Y
        
y      c][                       !
   ...
6Z ^
Z   S
Z   ] [
Upcoming SlideShare
Loading in …5
×

3分くらいで分かるassert()

1,920 views
1,874 views

Published on

2007/11/21 PHP懇親会
http://d.hatena.ne.jp/i_ogi/20071122/1195763577

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,920
On SlideShare
0
From Embeds
0
Number of Embeds
30
Actions
Shares
0
Downloads
10
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

3分くらいで分かるassert()

  1. 1. Z Z^ ,88079 KWWSSKSQHWDVVHUW
  2. 2. AA y Z^ = y _ `a ] yGKDWHQDQHMSLBRJL
  3. 3. ,88079 ^
  4. 4. ,88079 Z Z[ ERRO DVVHUW PL[HG DVVHUWLRQ y2 [DVVHUWLRQ =A Z )$/6( ] = y =_c [ = c ! [ = B Z [ tLQL _ Z DVVHUWBRSWLRQV
  5. 5. ,88079 Z Z[ y _c y 3+38QLW DVVHUW7UXH Z =7UXH ^ Z a [^ ycc ` = DVVHUWDFWLYH 2II ^
  6. 6. ,88079 Z Z[ function hoge($max) { // 0 $max $ret = mt_rand(0, $max): * // 0 $max assert(0 = $ret $ret = $max); * return $ret; }
  7. 7. ,88079 Z Z[ function hoge($max) { // 0 $max $ret = mt_rand(0, $max); * // 0 $max assert('0 = $ret $ret = $max'); * return $ret; }
  8. 8. 29*7,3/ LQW PLQ LQW PD[@ y ] PWBUDQG Z= PLQ ! PD[[ ^ y Z [ hoge(-10); Warning: assert(): Assertion quot;0 = $ret $ret = $maxquot; failed in test.php on line 7
  9. 9. ,88079 y HYDO y []] t Z ^ y ^= ZHYDO
  10. 10. ,88079 1) PHP_FUNCTION(assert) { zval **assertion; int val; char *myeval = NULL; char *compiled_string_description; if (! ASSERTG(active)) { RETURN_TRUE; c Z_ } #709:73 if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, assertion) == F WRONG_PARAM_COUNT; }
  11. 11. ] = ^ Q ! + y W []] = B `a ^Z ^ y1) ^Z = 3+3 ][ Z
  12. 12. y ! `aZ ^ y HYDO Y y c][ ! [
  13. 13. 6Z ^ Z S
  14. 14. Z ] [

×