Just a test
Mikhail Berman
Just a test
I donĀ¹t seem to be getting any messages, this is just a test, mysql query -- - Scott HanedaTel: 415.898.2602 http://www.newgeo.com Fax: 313.557.5052 [EMAIL PROTECTED]Novato, CA U.S.A. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
This is just a test: sql,query,
sql,query - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: [OT] C program warnning (Just a test i try to understand C in order to build my mysql client program)
Hi. You know, this question is off-topic on the MySQL list. On Wed, Feb 14, 2001 at 09:54:44AM +, [EMAIL PROTECTED] wrote: Hi folks, I am trying to compile a simple program to play with mysql. But i am running into single problems, but i guess easy to solve by too many of the wizards here. I am too paranoic when compiling my programs, so i activate all warnning (at least i try) flags to gnu c compiler. The problem occurs when type conversion: type conversion is automatic when a functions takes a single pointer to const anything, but when there is a double pointer to a const type and i pass double pointer to a non const type i run into problem? Why in the later case conversion is not automatic? the former is. This is a FAQ, see e.g. http://faqs.jmas.co.jp/FAQs/C-faq/faq, section 11.10. For a somewhat better explanation have a look at the C++ FAQ (and also applies to your C program): http://reality.sgi.com/austern_mti/std-c++/faq.html#C1 The summary is that one could bypass the const qualifier c() adds (not in your example, but in general). Here is the simple code (just to test): #include stdio.h int t(const int *i) { printf("%d\n", *i); return 0; } void c(const char **reg) With C++, you can declare it as void c(const char * const* reg) but this does not seem to be allowed in C (I am not used to C anymore, but gcc 2.95.3 complains). { while (*reg) printf("%s\n", *reg++); } int main(int argc, char *argv[]) { int i; char*reg[] = { "Gustavo", "Vieira", "Goncalves", "Coelho", "Rios", NULL}; The other way is to declare "reg" to what is really is, instead: const char *reg[] = ... This will also work with C. The solution of the C-FAQ is dirty (as it opens the hole again because of which the auto cast is not made) and should IMHO be avoided, if possible. Bye, Benjamin. i = 10; (void) t(i); c(reg); return 0; } But when compiling: grios@etosha$ cc -ansi -pedantic -Wconversion -Wall -Werror t.c cc1: warnings being treated as errors t.c: In function `main': t.c:30: warning: passing arg 1 of `c' from incompatible pointer type grios@etosha$ [...] - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
C program warnning (Just a test i try to understand C in order to build my mysql client program)
Hi folks, I am trying to compile a simple program to play with mysql. But i am running into single problems, but i guess easy to solve by too many of the wizards here. I am too paranoic when compiling my programs, so i activate all warnning (at least i try) flags to gnu c compiler. The problem occurs when type conversion: type conversion is automatic when a functions takes a single pointer to const anything, but when there is a double pointer to a const type and i pass double pointer to a non const type i run into problem? Why in the later case conversion is not automatic? the former is. Here is the simple code (just to test): #include stdio.h int t(const int *i) { printf("%d\n", *i); return 0; } void c(const char **reg) { while (*reg) printf("%s\n", *reg++); } int main(int argc, char *argv[]) { int i; char*reg[] = { "Gustavo", "Vieira", "Goncalves", "Coelho", "Rios", NULL}; i = 10; (void) t(i); c(reg); return 0; } But when compiling: grios@etosha$ cc -ansi -pedantic -Wconversion -Wall -Werror t.c cc1: warnings being treated as errors t.c: In function `main': t.c:30: warning: passing arg 1 of `c' from incompatible pointer type grios@etosha$ Why there is no problem when i pass a int * to as an argument to a function that requires a const int * but when the argument is a double pointer to a const it complains if i pass a double pointer to a non const type. This warnnings always happen even if the argument requirement is of type const [int|float|double|any_thing] ** and the value passed is [int|float|double|any_thing] **. Why automatic conversion does not take place here too ? Thanks a lot for your time and cooperation. - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php