
|
Apologies for the shouting but this is important.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|

|
For those new to message boards please try to follow a few simple rules when posting your question.- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode HTML tags when pasting" checkbox before pasting anything inside the PRE block, and make sure "Ignore HTML tags in this message" check box is unchecked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question in one forum from another, unrelated forum (such as the lounge). It will be deleted.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|

|
Hi everyone,
Right now, I am creating a project in C and at some point I am accessing, multi times during the source code, to a struct with a lot of nested structs, like this
struct1->struct2->struct3->struct4->struct5->value1
struct1->struct2->struct3->struct4->struct6->value2
What I created was a macro to clear the code:
#define ACCESS (struct1->struct2->struct3->struct4)
ACCESS->struct5->value1
ACCESS->struct6->value2
My question is: This is a good practice or a very very very bad practice?
Best regards,
Filipe Marques
|
|
|
|

|
Bad practice is using such chains of pointers. You should check if that can be avoided. If structure members can share memory locations, you should use unions.
I would use a variable instead to make the code more readable and avoid the chain:
struct4_t *struct4 = struct1->struct2->struct3->struct4;
s5val = struct4->struct5->value;
|
|
|
|

|
Very bad practice, it makes it difficult to understand or maintain the code; you should look closely at your design. You may also benefit from upgrading to C++ and using classes instead of structs.
Veni, vidi, abiit domum
|
|
|
|

|
Hi!
I am a new one for c++. I have to plane create a new adblock application for the browsers(Firefox, Chrome and safari). I don't have any idea. Please anyone help me and guide me. Its urgent.
|
|
|
|

|
It would probably be best to create add-ins for the different browsers. You'll have to research and study how to create add-ins for Firefox, Chrome and Safari.
I know that to develop for the Apple platform requires you to join their developer program which costs money.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|

|
Is there anyway to do this app?
|
|
|
|

|
Of course there is. But you can't learn how from some forum posts. You have to study how to create add-ins for the specific browsers.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|

|
Thanks for your reply...
I will study.
Thanks again.
|
|
|
|