FjjDessoyCaraballo / minishell

This project aims to replicate bash shell
1 stars 3 forks source link

Norm and formatting #68

Closed BrunoPosa closed 2 months ago

BrunoPosa commented 2 months ago

Last chore before submitting to vogsphere - Ensure the 42header authors are correct

BrunoPosa commented 2 months ago

single_q(), doubleq(), handle_env_variable() have 5 args instead of 4 image

BrunoPosa commented 2 months ago

TLDR: we should prefix some or all our Macros, e.g.: FILE --> SHL_FILE

GPT explains: The macros you defined might potentially conflict with macros in standard libraries or popular headers. Here’s a breakdown of the most commonly used ones that might cause issues and some suggestions on how to handle them:

  1. Common Macros in Standard Headers

    SUCCESS and FAILURE: These are common macros that might conflict with other headers or libraries. For example, SUCCESS is sometimes defined as 0 in various libraries, and FAILURE is often defined as a non-zero value (often -1 or 1). FILE: This is a critical one because FILE is a standard type in C, defined in for file streams. Redefining this will likely cause conflicts. NULL_LINE: The term NULL is often used in many headers, though not exactly as NULL_LINE. However, to avoid confusion, it might be wise to choose a less generic name. COMMAND_NOT_FOUND and PERMISSION_DENIED: These are quite specific, but similar macros might exist in other systems or libraries. They are less likely to cause issues but should be watched. ERR: This is a bit generic and could be used in other libraries.

  2. Recommendations

To avoid potential conflicts, you can:

Namespace Your Macros: Prefix your macros with a unique identifier related to your project or application. For example:
    #define MYAPP_SUCCESS 0
    #define MYAPP_FAILURE 1
    #define MYAPP_FILE 55
    #define MYAPP_ERR "Error\n"

Check Existing Libraries: Check the headers of any libraries you’re using to see if any of these macros are already defined. If they are, consider renaming your macros or using #undef to undefine the conflicting macro before your definition.
FjjDessoyCaraballo commented 2 months ago

Closing issue: formatting done since commit 58b08b1f352fa771898701a5495f81d81f2a514c