Code Question in FAT Filesystem

Eric Norum wenorum at lbl.gov
Mon Aug 23 18:29:58 UTC 2010


I'm no expert on C++, but for C at least, I don't see any type qualifier being specified more than once:
	const char *const foo
declares foo to be a constant pointer to constant character(s)

This is different than
	const *bar
which declares bar as a mutable pointer to constant character(s)

or
	char *const bletch
which declares bletch as a constant pointer to mutable character(s)

So, with these declarations:
	1) bletch could never appear as an lvalue, but *bletch could
	2) *bar could never appear as an lvalue, but bar could
	2) foo could never appear as an lvalue nor could *foo appear as an lvalue

FWIW.

On Aug 23, 2010, at 11:20 AM, Joel Sherrill wrote:

> Hi,
> 
> I came across this while trying to review
> Coverity output.
> 
> [joel at iceland dosfs]$ grep "const char const" *
> msdos.h:extern const char const* MSDOS_DOT_NAME;    /* ".", padded to MSDOS_NAME chars */
> msdos.h:extern const char const* MSDOS_DOTDOT_NAME; /* ".", padded to MSDOS_NAME chars */
> msdos_misc.c:const char const* MSDOS_DOT_NAME    = ".          ";
> msdos_misc.c:const char const* MSDOS_DOTDOT_NAME = "..         ";
> 
> My understanding is that this is legal in C99 and
> illegal in C++.
> 
> Coverity complains it is ...
> 
> *dupl_type_qualifier*: type qualifier specified more than once
> 
> 
> Would it be OK to change these to "const char *MSDOS_DOT_"?
> 
> -- 
> Joel Sherrill, Ph.D.             Director of Research&  Development
> joel.sherrill at OARcorp.com        On-Line Applications Research
> Ask me about RTEMS: a free RTOS  Huntsville AL 35805
>   Support Available             (256) 722-9985
> 
> 
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-users

-- 
Eric Norum
wenorum at lbl.gov





More information about the users mailing list