Can argv be NULL in C?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
Luis has a GDB patch https://sourceware.org/ml/gdb-patches/2016-10/msg00137.html
which checks whether argv is NULL or not, because argv is NULL in
his env (aarch64-elf).

Can argv be NULL in C?  In C standard, argc and argv is specified
in "hosted environment", so argv can't be NULL in "hosted environment".
The program start-up is implementation-defined in "freestanding
environment".  Then, in practise, is bare-metal a "freestanding
environment"?  The bare-metal may still have its C library, like newlib,
so is it a "freestanding environment" or "hosted environment"?

In this particular case, the C code has main function, so it expects
argument passing (argc and argv) from somewhere else, so my
understanding is that it is "hosted environment", and its argv must
be non-NULL.

-- 
Yao (齐尧)




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux