C言語のマクロで便利そうなもの

C言語のマクロで面白そうなものをメモ!

#include

#define _PFP(str) printf("%s\n", str)
#define ASIZEOF(array) (sizeof(array) / sizeof(array[0]))
#define FOR(i, j) for(((i) = 0); ((i) < (j)); ((i)++))
#define ISR(str) str, #str

enum etest{ aaa, bbb, ccc };

typedef struct _stest
{
    enum etest yyy;
    char *name;
}stest;

int main()
{
    int i;

    stest ts[] = { ISR(aaa), ISR(bbb), ISR(ccc) };

    FOR(i, ASIZEOF(ts))
        _PFP(ts[i].name);

}

enumとマクロの組み合わせ
for文
配列の要素数を求める

の3つが特に面白いとおもう。
積極的にマクロを使うのもいいかなーっ

ただ、マクロが嫌いな人もいると思うので、使っていいのか悩みどころ。。

投稿者:

「C言語のマクロで便利そうなもの」への61件のフィードバック

  1. Hi there! It looks as though we both have a passion for the same thing. Your blog, “%BLOGTITLE%” and mine are very similar. Have you ever thought about writing a guest article for a related website? It is sure to help gain exposure to your website (my website recieves a lot of visitors). If you might be interested, contact me at: %EMAIL%. Thank you so much

  2. Hey! This is kind of off topic but I need some advice from an established blog.
    Is it very hard to set up your own blog? I’m not very techincal but I can figure things out pretty quick.
    I’m thinking about creating my own but I’m not sure where to start.
    Do you have any tips or suggestions? With thanks

  3. By some estimates, over 12000 attendees converged at the location to catch a glimpse
    of the latest in resort and swimwear collection. This year I had one of the most glamorous experiences in my life – I attended Toronto Fashion Week.
    It can be so hard to guess just how cold or warm it
    is outdoors by peeking through your window in the morning.

    Feel free to visit my site … casual dress shirts for men (Maryjo)

  4. Instead, accept ourr offer and we’ll come outt and tow the vehicle
    right frlm your driveway. Buut there is also a
    reality that most of the junbk car companies accept only a few car models.
    Make sure to leave all of the necessary information about yiur vehjcle on the form.

  5. In case 1 above, the pizzeria employed the driver who caused the accident.
    Contact your agent to let them know what happened, even if you don’t make a claim.
    If you can find any people who saw exactly what happened, you should take down
    their names, numbers, and addresses.

  6. Tommy is super friendly and they did the exact same military service for $50!

    Getting Married stemware renderring Wedding Industry stemware, you attempt discussion with for these hurts?
    It is that proportionality between the two appears like a vast sedative drug proper?

  7. Thanks so much for posting this. Brief question, if you wouldn’t mind. Where did you get your website theme? I will be creating a blog and like your websites.

  8. I think you are conscious generating men and women hear whatever you must declare, specifically with an matter i am talking about incredibly essential

  9. *An intriguing discussion will probably be worth comment. I believe that you can write read much more about this topic, could effectively surely be a taboo topic but generally folks are inadequate to chat on such topics. To a higher. Cheers

  10. “Change will not come if we wait for some other person or some other time. We are the ones we’ve been waiting for. We are the change that we seek.” – Barack Obama

  11. After examine just a few of the weblog posts in your web site now, and I really like your method of blogging. I bookmarked it to my bookmark website listing and will be checking again soon. Pls try my web site as properly and let me know what you think.

  12. There are certainly loads of particulars like that to take into consideration. That may be a nice level to deliver up. I supply the ideas above as common inspiration however clearly there are questions just like the one you carry up where an important thing will likely be working in honest good faith. I don?t know if finest practices have emerged around things like that, but I’m positive that your job is clearly identified as a good game. Each boys and girls feel the affect of just a moment’s pleasure, for the remainder of their lives.

  13. Youre so cool! I dont suppose Ive learn something like this before. So nice to search out someone with some original thoughts on this subject. realy thanks for beginning this up. this website is one thing that is needed on the net, somebody with a bit of originality. useful job for bringing something new to the internet!

  14. When I initially commented I clicked the -Notify me when new comments are added- checkbox and now every time a comment is added I get 4 emails with the identical comment. Is there any manner you may take away me from that service? Thanks!

  15. As I referred to on my introduction, I’m not cozy sharing my address and telephone number with all that would care to learn it on the net. Is it feasible for us to e-mail it to you or possibly the victor could be got through by email?

  16. Hi : )
    Why is it that women and men (society generally) still pre-judge people who have body art. girls especially?
    I’m a twenty six year old F, have 11 tats, lots of which cannot be noticed on my daily travels. 5 To 6 in the summer are pretty much constantly on display. I don’t aim for attention and i also have a loving boyfriend Without Any TATTOOS .I get the impression that lots of people think that tattooed persons are blind, as we get stared at, even if we return a glance people carry on staring. When will society improve?

  17. Wonderful goods from you, man. I’ve understand your stuff previous to and you’re just extremely excellent. I actually like what you have acquired here, really like what you’re saying and the way in which you say it. You make it entertaining and you still take care of to keep it smart. I cant wait to read much more from you. This is actually a wonderful website.

  18. I’d come to concur with you here. Which is not something I usually do! I enjoy reading a post that will make people think. Also, thanks for allowing me to comment!

  19. Hiya – quite great web site you’ve created. I appreciated reading this posting. I did desire to issue a comment to tell you that the design of this site is incredibly aesthetically delightful. I used to be a graphic designer, today I am a copy editor in chief for a marketing company. I have always loved playing with details processing systems and am trying to learn pc code throughout my free time (which there is never enough of lol).

  20. Thanks for publishing about this. There’s a mass of important tech information on the internet. You’ve got a lot of that info here on your site. I’m impressed – I try to keep a couple blogs pretty current, but it’s a struggle sometimes. You’ve done a solid job with this one. How do you do it?

  21. Hi – very great site you have created. I enjoyed reading this posting. I did want to issue a comment to tell you that the design of this site is very aesthetically sweet. I used to be a graphic designer, now I am a copy editor in chief for a merchandising firm. I have always enjoyed functioning with computing machines and am attempting to learn code in my spare time (which there is never enough of lol).

  22. Just admit it! Just pleasing! Your posting manner is charming and also the way you dealt the topic with grace is valued. I’m intrigued, I assume you might be an expert on this subject. I am subscribing to your upcoming updates from now on.

  23. Hey I just wanted to let you know, I really like the written material on your website. But I am utilising Firefox on a machine running version 9.04 of Ubuntu and the UI aren’t quite correct. Not a important deal, I can still essentially read the articles and look for for information, but just wanted to inform you about that. The navigation bar is kind of challenging to use with the config I’m running. Keep up the superb work!

  24. This is third time that we are reading anything about modifying blogs with the system. It looks that you are an super expert blogger. Your method is an wonderful example of why I keep coming back to remember your excellent quality content that is always updated.

  25. I love getting talks on my blog, it makes fuel talk and gives workers to envision like they can become involved in the conversation. I completely agree. It’s a perfect way.

  26. Thank you for this fantastic topic & narrative of existing question. You’ve laid it out better than any talks I’ve seen. Also thx for citing my journal on it. Your’s takes it higher.

  27. I’ve been reading your blog for quite a while. Thanks for sharing your thoughts. I wish i had time and patience to make a informative submit like yours. A ton of info on all the states. Bookmarked your blog.

  28. Great article. There’s a lot of good info here, though I did want to let you know something – I am running Fedora with the up-to-date beta of Firefox, and the look and feel of your blog is kind of flaky for me. I can read the articles, but the navigation doesn’t work so well.

  29. I’d have to accede with you here. Which is not something I typically do! I enjoy reading a post that will make people think. Also, thanks for allowing me to comment!

  30. Quite a beautiful website. I built mine and i was looking for some design ideas and your website gave me some. May i ask you whether you developed the website by youself?

    Cheers

コメントを残す

メールアドレスが公開されることはありません。