posts - 15, comments - 37, trackbacks - 0, articles - 8

02 2005 档案

摘要: int f(int n){ int k = 5; int r = 0; while( n >= k) { r += n/k; k *= 5; } return r;}阅读全文

posted @ 2005-02-23 13:33 Panic 阅读(467) | 评论 (0) 编辑 |

摘要: isdigit(c)在linux/unix下的实现,使用查表法极大优化了代码效率,今天kiki问到了toupper的问题,忽然想看看这个函数的实现效率如何。看了M$的VC6的CRT目录,最终发现这个函数的实现是这样://仅核心代码:if ( (c >= 'a') && (c <= 'z') ) c = c - ('a' - 'A'); return c;感觉很失望。相关...阅读全文

posted @ 2005-02-22 17:24 Panic 阅读(858) | 评论 (2) 编辑 |

摘要: #include <Winsock2.h>#include <iostream>void main(){ unsigned long ip1 = inet_addr("192.168.0.1"); unsigned long ip2 = inet_addr("192.168.20.255"); unsigned long ip; in_addr in; //好像有点错误,改...阅读全文

posted @ 2005-02-22 16:32 Panic 阅读(402) | 评论 (5) 编辑 |

posted @ 2005-02-22 12:01 Panic 阅读(397) | 评论 (2) 编辑 |

摘要: 问题提出:void main(){char *const p1="show me the money\n";cout<<p1;*(p1+3)='a';cout<<p1;}可以通过编译,但是运行出错,为什么?原因很简单,"show me the money\n"本身是一个常量字符串,在VC6.0下,系统把它放在了只读权限的内存空间。用可读写的指针指向这块区域本身就是错误的(逻...阅读全文

posted @ 2005-02-21 11:27 Panic 阅读(424) | 评论 (0) 编辑 |

摘要: 内存大户啊,才开了4个网页,就占了100多M的内存,吓死人啦4个网页分别是:PHP - PHP 完全中文手册MySQL中文参考手册-目录博客园-Panic的小屋VC知识库开发论坛 2004哎,郁闷,IE自己功能太少,开多窗口不方便,CPU占用率高。MyIE2,经常莫名其妙退出。FireFox资源占用太多,速度又慢。到底还有没有好用的浏览器啊???本来想给firefox汇报这个问题,结果在主页上,一...阅读全文

posted @ 2005-02-18 16:31 Panic 阅读(341) | 评论 (1) 编辑 |

摘要: #include <iostream>class A{public: operator int () //注意,这个函数就是循环体。 { std::cout << "loop" << std::endl; return *this; }};//测试代码:void main(){ (int)A();}//哈哈,运行一下试试吧,运行环境:VC6 Win2kPro。/...阅读全文

posted @ 2005-02-17 20:07 Panic 阅读(397) | 评论 (2) 编辑 |

摘要: 给个链接或者发到panic@eyou.com多谢了!!!:P阅读全文

posted @ 2005-02-17 13:38 Panic 阅读(751) | 评论 (4) 编辑 |

posted @ 2005-02-17 11:12 Panic 阅读(518) | 评论 (2) 编辑 |

posted @ 2005-02-07 12:51 Panic 阅读(226) | 评论 (0) 编辑 |

posted @ 2005-02-04 16:59 Panic 阅读(459) | 评论 (2) 编辑 |