1. K&R 风格

该配置文件使用了K&R风格的缩进方式,即花括号独占一行,且缩进量为4个空格。

# K&R style
-indent-level4
-le4
-bad

示例代码:

#include <stdio.h>

int main()
{
    int a = 1;
    if (a == 1)
    {
        printf("Hello, world!\n");
    }
    else
    {
        printf("Goodbye, world!\n");
    }
    return 0;
}
  1. GNU 风格

该配置文件使用了GNU风格的缩进方式,即花括号与前面的语句放在同一行,并且缩进量为2个空格。

# GNU style
-gnu
-indent-level2
-le2

示例代码:

#include <stdio.h>

int main()
{
  int a = 1;
  if (a == 1) {
    printf("Hello, world!\n");
  } else {
    printf("Goodbye, world!\n");
  }
  return 0;
}
  1. Allman 风格

该配置文件使用了Allman风格的缩进方式,即花括号独占一行,并且缩进量为4个空格。

# Allman style
-style=allman
-indent-level4
-le4

示例代码:

#include <stdio.h>

int main()
{
    int a = 1;
    if (a == 1)
    {
        printf("Hello, world!\n");
    }
    else
    {
        printf("Goodbye, world!\n");
    }
    return 0;
}
  1. Whitesmiths 风格

该配置文件使用了Whitesmiths风格的缩进方式,即花括号独占一行,并且缩进量为2个空格。

# Whitesmiths style
-style=whitesmiths
-indent-level2
-le2

示例代码:

#include <stdio.h>

int main()
{
  int a = 1;
  if (a == 1)
    {
      printf("Hello, world!\n");
    }
  else
    {
      printf("Goodbye, world!\n");
    }
  return 0;
}
  1. Google 风格

该配置文件使用了Google风格的缩进方式,即花括号与前面的语句放在同一行,并且缩进量为2个空格。

# Google style
-style=google
-indent-level2
-le2

示例代码:

#include <stdio.h>

int main() {
  int a = 1;
  if (a == 1) {
    printf("Hello, world!\n");
  } else {
    printf("Goodbye, world!\n");
  }
  return 0;
}
``
推荐5个 indentpro 针对C语言的的配置文件内容 并给出示例代码 。

原文地址: http://www.cveoy.top/t/topic/ciKV 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录