Thread: labels inside the code #pragma mark label

  1. #1
    Registered User
    Join Date
    Nov 2006
    Location
    japan
    Posts
    126

    Question labels inside the code #pragma mark label

    Hi everyone
    I am mac OS programmer, with some C programming experience and no much windows programming experience.
    I wonder if there is and kind of equivalent to
    #pragma mark My_label
    where My_label is the name for a label inside the code and recognized by tools like Xcode. (and as far I know some linux tools also does recognize #pragma mark)
    In this case, I want my label be recognized by Visual C++ 2008 but #pragma mark label is not working. I suppose there is a different way wich I don't know.
    Please see attached JPG file.

    Help Please... My code is getting bigger and bigger and the is kind of difficult to see line by line.

    Thanks in advances.
    Mac OS 10.6 Snow Leopard : Darwin

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    There is no such functionality to my knowledge. Why do you need a label? It clearly outlines all your functions.
    And if you need to group them, you can always put them into other files.
    So what exactly is the problem?
    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.

  3. #3
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Pragmas, as a rule, are compiler-specific. Visual Studio doesn't know the mark pragma.

    It might recognize the region pragma. It was introduced in C#, but it might have been ported.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  4. #4
    Registered User
    Join Date
    Nov 2006
    Location
    japan
    Posts
    126
    to Elysia: I need labels because my functions are too complicated and long. (in the picture is just a simple program but, )I have to manage with 2 or 3 solutions, wich have alike content. So a Label would solve all my problems.

    to CornedBee: Can you explain more about the region pragma please
    is it something like #region pragma maybe?

    thanks.
    Mac OS 10.6 Snow Leopard : Darwin

  5. #5
    Registered User
    Join Date
    Nov 2006
    Location
    japan
    Posts
    126
    CornedBee, I just took a look, and I think #pragma region would work great for grouping code (in regions as the name suggest) but I t does not appear in the "global scope" place (the place where al my functions and types are listed.)

    #pragma region label
    ...
    content
    ...
    #pragma endregion

    it seems to be like Elysia said... there is no such a functionality!. BUUUU!!! VC++
    Mac OS 10.6 Snow Leopard : Darwin

  6. #6
    Registered User
    Join Date
    Apr 2006
    Posts
    2,149
    Quote Originally Posted by nacho4d View Post
    I need labels because my functions are too complicated and long.
    Then there are several things you should do:
    1) break up large functions into smaller ones, such that each function does exactly one thing.
    2) Use object oriented design to group your functions and the data they deal with into classes.
    3) Use namespaces to group related functions.
    It is too clear and so it is hard to see.
    A dunce once searched for fire with a lighted lantern.
    Had he known what fire was,
    He could have cooked his rice much sooner.

  7. #7
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    You can refer to documentation if the purposes of the functions are unclear. Tools like doxygen can generate documentation from the source.
    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. What did i do wrong? Code inside
    By The Rookie in forum C Programming
    Replies: 2
    Last Post: 05-18-2002, 08:14 AM
  2. How-To: Load Pictures in MFC. Code Inside.
    By Xei in forum C++ Programming
    Replies: 1
    Last Post: 05-16-2002, 09:17 PM
  3. << !! Posting Code? Read this First !! >>
    By biosx in forum C++ Programming
    Replies: 1
    Last Post: 03-20-2002, 12:51 PM
  4. Replies: 0
    Last Post: 02-21-2002, 06:05 PM
  5. Replies: 4
    Last Post: 01-16-2002, 12:04 AM

Tags for this Thread