&(&i) vs *(*i) in C

Tags: C/C++  

Is &(&i) valid in C?

No, I would not say so. we know the expression try to get an address of

an address of a variable, however, only after compiler time construction, we

could get a value for its address, for this exact time the compiler could not

return recognize the address of a new construct value in Compiler,

So it would print error.

 

 

leon Published by 2015-01-04 01:21

Detail »

C运行时库详解

Tags: VisualStudio   C/C++  

运行时库是程序在运行时所需要的库文件,通常运行时库是以LIB或DLL形式提供的。C运行时库诞生于20世纪70年代,当时的程序世界还很单纯,应用程序都是单线程的,多任务或多线程机制在此时还属于新观念。所以这个时期的C运行时库都是单线程的。
  随着操作系统多线程技术的发展,最初的C运行时库无法满足程序的需求,出现了严重的问题。C运行时库使用了多个全局变量(例如errno)和静态变量,这可能在多线程程序中引起冲突。假设两个线程都同时设置errno,其结果是后设置的errno会将先前的覆盖,用户得不到正确的错误信息。

leon Published by 2013-09-12 21:02

Detail »

LIB和DLL的区别和联系

Tags: VisualStudio   C/C++  

我们在做VC开发的时候,常常会遇到很多的关于lib和dll的问题,那么什么是lib文件,lib和dll的关系如何?

(1)lib是编译时需要的,dll是运行时需要的。
如果要完成源代码的编译,有lib就够了。
如果要使动态连接的程序运行起来,有dll就够了。
在开发和调试阶段,当然最好都有。

leon Published by 2013-02-23 22:00

Detail »

Practice Problems

Tags: C/C++  

1.about for-loop

public class Test {
    public static void main(String[] args) {
        int i=0;
        for(f('A');f('B')&&i<2;f('C')){
            i++;
            f('D');
        }
    }

leon Published by 2013-02-01 17:17

Detail »

MTd,MDd链接选项介绍

Tags: C/C++  

在Windows下有六种类型CRTLib(C运行库):
Reusable Library                Switch    Library    Macro(s) Defined
----------------------------------------------------------------
Single Threaded                     /ML       LIBC               (none)
Static MultiThread                  /MT       LIBCMT         _MT
Dynamic Link (DLL)              /MD       MSVCRT        _MT and _DLL
Debug Single Threaded           /MLd      LIBCD          _DEBUG
Debug Static MultiThread        /MTd      LIBCMTD    _DEBUG and _MT
Debug Dynamic Link (DLL)    /MDd      MSVCRTD    _DEBUG, _MT, and _DLL

leon Published by 2013-01-11 14:44

Detail »