Thread: Helping With Warnings

  1. #1
    Registered User
    Join Date
    Feb 2008
    Location
    N?A
    Posts
    23

    Question Helping With Warnings

    hallo to everyone
    and sorry for the mistakes in English
    i have some warnings error in some progarm
    (i worked with visual studio 2005 and 2008 and in both it's show this warning )

    image is attached to show the warnings



    thanks
    shimon Israel

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    IMHO - you should disable warning C4996 - Microsoft tries to push its own version of standard functoins. I see no reason to use them - the portability of the code suffers.

    So just disable this particular warning in the project settings and be happy

    PS. about another warning - you need to provide struct declaration. Are you sure you are compiling in the C-mode? Is your source file has a C extention? not cpp?

    PPS. in general it means you have 2 pointers one declared with typedef like
    Node* pointerA;

    Another without:
    struct Node* pointerB;
    When you write
    pointerB = pointerA; you can get that warning
    Last edited by vart; 02-13-2008 at 10:05 PM.
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  3. #3
    Registered User
    Join Date
    Feb 2008
    Location
    N?A
    Posts
    23
    Quote Originally Posted by vart View Post
    IMHO - you should disable warning C4996 - Microsoft tries to push its own version of standard functoins. I see no reason to use them - the portability of the code suffers.

    So just disable this particular warning in the project settings and be happy

    PS. about another warning - you need to provide struct declaration. Are you sure you are compiling in the C-mode? Is your source file has a C extention? not cpp?

    PPS. in general it means you have 2 pointers one declared with typedef like
    Node* pointerA;

    Another without:
    struct Node* pointerB;
    When you write
    pointerB = pointerA; you can get that warning
    thanks
    my name is Shimon and not what you wrote(the Hebrew name to "simon" in English)
    OK so what the solution to the second mistake


    here are the structs and the pointers in the attached file

    the curr deceleration is
    Code:
    	SamplingNode *curr=NULL
    Last edited by c9dw2rm8; 02-13-2008 at 10:36 PM.

  4. #4
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    You do not have a struct SamplingNode anywhere in your code

    Post code in code tags as text - so it could be copy/pasted by others going to answer your post

    IMHO == In My Humble Opinion and not what you think
    Ata zarich lilmod lehishtamesh beGoggle

    Ps. You should increase your warning level
    lines like
    struct SensorNode* Next; - should be warned by compiler as missing type declaration
    Last edited by vart; 02-13-2008 at 10:42 PM.
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  5. #5
    Registered User
    Join Date
    Feb 2008
    Location
    N?A
    Posts
    23
    Quote Originally Posted by vart View Post
    You do not have a struct SamplingNode anywhere in your code


    Ata zarich lilmod lehishtamesh beGoggle

    declaration


    GADOL!!

    מה בדיוק יעזור לי גוגל??

  6. #6
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    It will help to find out what is IMHO and others abbreviations like that
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  7. #7
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by vart View Post
    IMHO - you should disable warning C4996 - Microsoft tries to push its own version of standard functoins. I see no reason to use them - the portability of the code suffers.
    I strongly disagree. Microsoft did us a boon by giving more safe functions than the normal, poor buffer overrun prone functions. We should use them if possible.
    They are very easy to get rid of with a wrapper function or a macro, so I see no reason to not use them.

    They will help you find problems with buffer overruns in your code and stop your code from doing bad things in release. Fixes security problems.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  8. #8
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by Elysia View Post
    I strongly disagree. Microsoft did us a boon by giving more safe functions than the normal, poor buffer overrun prone functions. We should use them if possible.
    They are very easy to get rid of with a wrapper function or a macro, so I see no reason to not use them.

    They will help you find problems with buffer overruns in your code and stop your code from doing bad things in release. Fixes security problems.
    I always define that macro to disable those warnings. I don't really see how their proprietary functions are going to be that much safer? I always know the size of my arrays and I make sure I don't overflow it. Maybe those new functions would be good for really bad programmers that don't pay attention to what they're doing, but even then, if they pass the wrong parameters to those functions it'll still cause problems.

  9. #9
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Even the best of programmers will have bugs in their code and sometimes they'll surface. It also helps when hunting down memory bugs since it will automatically alert you if you're trying to do a buffer overrun.
    I don't see much point in not using them, seeing as they're more secure (and it's far better to terminate the program than to let it run with buffer overruns in a security perspective), and it's very easy to do away with them when compiling in other compilers.
    You could do a small ifdef to check if compiling with msvc, and if not, just do wrappers for the safe versions to the normal ones.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Advice on removing valid (but minor) compiler warnings
    By PaulBlay in forum C Programming
    Replies: 12
    Last Post: 04-20-2009, 12:16 PM
  2. Warnings when using vector of vector
    By Boksha in forum C++ Programming
    Replies: 5
    Last Post: 03-29-2008, 01:54 PM
  3. Compilers and warnings
    By rogster001 in forum C Programming
    Replies: 6
    Last Post: 03-26-2008, 05:16 AM
  4. Replies: 9
    Last Post: 03-14-2008, 09:55 AM
  5. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 06:49 PM