none
Mix code and delclaration in C code

    Question

  • Hi,

    according to this page http://msdn.microsoft.com/en-us/library/hh409293.aspx  it should be possible to mix declarations and code in C code. I have tried this with Visual Studio Express 2013 and it does not work. Is there something I forgot? Or is this supposed to only work with the professional editions of VS?

    Thanks,

    Tobias

    Thursday, January 9, 2014 10:30 AM

Answers

All replies

  • Hi Tobias,

    Actually this forum is to discuss the VS Usage.

    If you want to know whether this feature is supported in specific VS version, could you share us a simple sample? How to repro this issue (mix declarations and code in C code) in my side? Not the real C++/C expert, so if possible, you could share me a simple sample, I will check it in my side with different VS 2013 versions.

    Please also attach your Visual Studio project, you can upload it to the sky drive, and then share the download link in your post. Please also attach a screenshot image in your post. If there's any concern, please feel free to let me know.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, January 13, 2014 8:51 AM
    Moderator
  • It does work provided the declarations are before the code used, and is declared for every path in the code.  You will get error message if the declarations are put in the wrong place when you have if, for, while, using, and try threads in the code.  As well as other thread type structures.  Putting the declarations at the beginning of the code will always work.

    jdweng

    Monday, January 13, 2014 9:11 AM