Re: help needed with filnames as command line arguments
From: Irrwahn Grausewitz (irrwahn33_at_freenet.de)
Date: 10/18/03
- Next message: Sidney Cadot: "Re: how to convert double to short ?"
- Previous message: Irrwahn Grausewitz: "Re: why still use C?"
- In reply to: Craigb: "Re: help needed with filnames as command line arguments"
- Next in thread: Craigb: "Re: help needed with filnames as command line arguments"
- Reply: Craigb: "Re: help needed with filnames as command line arguments"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 18 Oct 2003 12:50:06 +0200
craigb@smartchat.net.au (Craigb) wrote:
>> <meta rant>
>> I am impressed by the fact that only one out of four replies (so far)
>> contained correct code. Please, test your code before you post it.
>> Thank you.
>> </meta rant>
>>
>> Regards
>
>Tested... *still* works fine for me, however.. appreciate the
>feedback. Tested on Bloodshed gcc and Cygwins gcc also in case you're
>wondering.
Really? Let's see...
Output generated by MingW32 (gcc 3.2, the version that comes with
Bloodshed DevCpp, so probably the same you use):
[...]
gcc.exe "D:\Temp\CraigB_1.c" -o "D:\Temp\CraigB_1.exe" -W -Wall
-std=c99 -O3 -I[...] -L[...]
[...]
D:/Temp/CraigB_1.c:8: warning: passing arg 2 of `printargstuff'
makes pointer from integer without a cast [1]
OK, now let's review your code:
...
003 int printargstuff(int aa, char *bb[]);
...
006 int main(int argc, char *argv[])
007 {
008 printargstuff(argc, *argv[0]);
...
The second argument of printargstuff() has to be a
pointer-to-pointer-to-character. You pass *argc[0] to it,
which is a character. Now please explain how this is
supposed to work without invoking undefined behaviour.
[1] You most probably didn't set your warning level to a
suitable amount. Warnings usually _are_ errors!
Regards
-- Irrwahn (irrwahn33@freenet.de)
- Next message: Sidney Cadot: "Re: how to convert double to short ?"
- Previous message: Irrwahn Grausewitz: "Re: why still use C?"
- In reply to: Craigb: "Re: help needed with filnames as command line arguments"
- Next in thread: Craigb: "Re: help needed with filnames as command line arguments"
- Reply: Craigb: "Re: help needed with filnames as command line arguments"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|